mirror of
https://github.com/fluencelabs/redis
synced 2025-06-17 19:21:21 +00:00
Bitops: Stop overallocating storage space on set
Previously the string was created empty then re-sized to fit the offset, but sds resize causes the sds to over-allocate by at least 1 MB (which is a lot when you are operating at bit-level access). This also improves the speed of initial sets by 2% to 6% based on quick testing. Patch logic provided by @oranagra Fixes #1918
This commit is contained in:
@ -194,7 +194,7 @@ void setrangeCommand(redisClient *c) {
|
||||
if (checkStringLength(c,offset+sdslen(value)) != REDIS_OK)
|
||||
return;
|
||||
|
||||
o = createObject(REDIS_STRING,sdsempty());
|
||||
o = createObject(REDIS_STRING,sdsnewlen(NULL, offset+sdslen(value)));
|
||||
dbAdd(c->db,c->argv[1],o);
|
||||
} else {
|
||||
size_t olen;
|
||||
|
Reference in New Issue
Block a user