You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: use str::make_ascii_lowercase instead of str::to_lowercase
`str::to_lowercase` had been used for the purposes of case-insensitive
comparisons of command names, but `str::make_ascii_lowercase` is
substantially more performant. Using:
$ redis-benchmark -c 1 -r 128 -t set -n 100000
...with `str::to_lowercase`:
throughput summary: 6651.59 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.136 0.072 0.135 0.223 0.287 2.807
...with `str::make_ascii_lowercase`:
throughput summary: 9102.49 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.099 0.064 0.095 0.127 0.191 0.815
While micro-optimizations are usually not appropriate for mini-redis,
this pattern of case-insensitive string comparisons is common, and
using `str::to_lowercase` sets a bad example.
0 commit comments