diff options
author | Viktor Söderqvist <viktor@zuiderkwast.se> | 2022-12-06 10:25:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-06 11:25:51 +0200 |
commit | 8a315fc285fc54c678b97107a02ee1627f2c1ebf (patch) | |
tree | 071fb308821df6f94a91e562a355b08db6e4774d /src/object.c | |
parent | 8f13ac10b46de0c6f3cb9fd5c9e86824aa1e8355 (diff) | |
download | redis-8a315fc285fc54c678b97107a02ee1627f2c1ebf.tar.gz |
When converting a set to dict, presize for one more element to be added (#11559)
In most cases when a listpack or intset is converted to a dict, the conversion
is trigged when adding an element. The extra element is added after conversion
to dict (in all cases except when the conversion is triggered by
set-max-intset-entries being reached).
If set-max-listpack-entries is set to a power of two, let's say 128, when
adding the 129th element, the 128 element listpack is first converted to a dict
with a hashtable presized for 128 elements. After converting to dict, the 129th
element is added to the dict which immediately triggers incremental rehashing
to size 256.
This commit instead presizes the dict to one more element, with the assumption
that conversion to dict is followed by adding another element, so the dict
doesn't immediately need rehashing.
Co-authored-by: sundb <sundbcn@gmail.com>
Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/object.c')
0 files changed, 0 insertions, 0 deletions