• Madelyn Olson's avatar
    Minor performance improvement to SADD and HSET (#12019) · a129a601
    Madelyn Olson authored
    For sets and hashes that will eventually be stored as the hash encoding, it's much faster to immediately convert them to their hash encoding and then perform the insertions since it avoids the O(N) search and frequent reallocations. This change checks the number of arguments in the incoming command, and converts the data-structure if the number of new entries exceeds the listpack-max-entries configuration. This can cause us to over-allocate memory if their are duplicate entries in the input, which is unexpected.
    
    unstable
    
    Summary:
      throughput summary: 805.54 requests per second
      latency summary (msec):
              avg       min       p50       p95       p99       max
           61.908    25.680    68.351    73.279    75.967    79.295
    hset-improvement
    
    Summary:
      throughput summary: 4701.46 requests per second
      latency summary (msec):
              avg       min       p50       p95       p99       max
           10.546     0.832    11.959    12.471    13.119    14.967
    a129a601
t_hash.c 38.5 KB