mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix: improve performance of listpack sorted sets (#1885)
1. Cherry-pick changes from Redis 7 that encode integer scores more efficiently 2. Introduces optimization that first checks if the new element should be the last for listpack sorted sets. 3. Consolidates listpack related constants and tightens usage for listpack. 4. Introduce MEMORY USAGE command. 5. Introduce a small delay before decommitting memory pages back to OS. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
cfd83a66a2
commit
8d1474aeac
18 changed files with 124 additions and 279 deletions
|
@ -469,8 +469,8 @@ int RobjWrapper::ZsetAdd(double score, sds ele, int in_flags, int* out_flags, do
|
|||
|
||||
/* check if the element is too large or the list
|
||||
* becomes too long *before* executing zzlInsert. */
|
||||
if (zl_len + 1 > server.zset_max_listpack_entries ||
|
||||
sdslen(ele) > server.zset_max_listpack_value || !lpSafeToAdd(lp, sdslen(ele))) {
|
||||
if (zl_len >= server.zset_max_listpack_entries ||
|
||||
sdslen(ele) > server.zset_max_listpack_value) {
|
||||
unique_ptr<SortedMap> ss = SortedMap::FromListPack(tl.local_mr, lp);
|
||||
lpFree(lp);
|
||||
inner_obj_ = ss.release();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue