Commit 7d0478974aadb80dffa8c46624440d9a7efc843d
1 parent
55c56d87
Update speed tests
Things are faster with vectors! Also added a note about strToVec and vecToStr, and made them static methods.
Showing
2 changed files
with
15 additions
and
13 deletions
README.md
| ... | ... | @@ -30,20 +30,22 @@ asynchronous API of hiredis, even for synchronous commands. There is no dependen |
| 30 | 30 | Boost or any other libraries. |
| 31 | 31 | |
| 32 | 32 | ## Benchmarks |
| 33 | -Benchmarks are given by averaging the results of five trials of the speed tests | |
| 34 | -in `examples/` on an AWS t2.medium instance running Ubuntu 14.04 (64-bit). | |
| 33 | +Benchmarks are given by averaging the results of ten trials of the speed tests | |
| 34 | +in `examples/` on an AWS t2.medium instance running Ubuntu 14.04 (64-bit) and a | |
| 35 | +local Redis server. | |
| 35 | 36 | |
| 36 | -Local Redis server, TCP connection: | |
| 37 | + * `speed_test_async_multi` over TCP: **879,589 commands/s** | |
| 38 | + * `speed_test_async_multi` over Unix socket: **901,683 commands/s** | |
| 39 | + * `speed_test_async` over TCP: **203,285 commands/s** | |
| 40 | + * `speed_test_async` over Unix socket: **301,823 commands/s** | |
| 41 | + * `speed_test_sync` over TCP: **21,072 commands/s** | |
| 42 | + * `speed_test_sync` over TCP: **24,911 commands/s** | |
| 37 | 43 | |
| 38 | - * 100 command loops (`speed_test_async_multi`): **685,249 commands/s** | |
| 39 | - * One command loop (`speed_test_async`): **195,439 commands/s** | |
| 40 | - * Looped synchronous command (`speed_test_sync`): **23,012 commands/s** | |
| 41 | - | |
| 42 | -Results are comparable to that of an average laptop. On a high-end machine, | |
| 43 | -`speed_test_async_multi` usually tops 1,000,000 commands/s. | |
| 44 | +Results are comparable to that of a mid-range laptop. On a high-end machine, performance | |
| 45 | +can be much higher. | |
| 44 | 46 | |
| 45 | 47 | ## Tutorial |
| 46 | -This section introduces the main features of redox. Look in the `examples/` for more inspiration. | |
| 48 | +This section introduces the main features of redox. Look in `examples/` for more inspiration. | |
| 47 | 49 | |
| 48 | 50 | #### Hello world |
| 49 | 51 | Here is the simplest possible redox program: |
| ... | ... | @@ -173,7 +175,7 @@ representation of the command (`GET hello` in this case). |
| 173 | 175 | We often want to run commands on regular invervals. Redox provides the `commandLoop` |
| 174 | 176 | method to accomplish this. It is easier to use and more efficient than running individual |
| 175 | 177 | commands in a loop, because it only creates a single Command object. |
| 176 | -`commandLoop` takes a command string, a callback, and an interval (in seconds) | |
| 178 | +`commandLoop` takes a command vector, a callback, and an interval (in seconds) | |
| 177 | 179 | to repeat the command. It then runs the command on the given interval until the user |
| 178 | 180 | calls `c.free()`. |
| 179 | 181 | ... | ... |
include/redox/client.hpp
| ... | ... | @@ -184,13 +184,13 @@ public: |
| 184 | 184 | * Given a vector of strings, returns a string of the concatenated elements, separated |
| 185 | 185 | * by the delimiter. Useful for printing out a command string from a vector. |
| 186 | 186 | */ |
| 187 | - std::string vecToStr(const std::vector<std::string>& vec, const char delimiter = ' '); | |
| 187 | + static std::string vecToStr(const std::vector<std::string>& vec, const char delimiter = ' '); | |
| 188 | 188 | |
| 189 | 189 | /** |
| 190 | 190 | * Given a command string, returns a vector of strings by splitting the input by |
| 191 | 191 | * the delimiter. Useful for turning a string input into a command. |
| 192 | 192 | */ |
| 193 | - std::vector<std::string> strToVec(const std::string& s, const char delimiter = ' '); | |
| 193 | + static std::vector<std::string> strToVec(const std::string& s, const char delimiter = ' '); | |
| 194 | 194 | |
| 195 | 195 | // ------------------------------------------------ |
| 196 | 196 | // Command wrapper methods for convenience only | ... | ... |