diff options
author | filipe oliveira <filipecosta.90@gmail.com> | 2022-12-05 06:33:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-05 08:33:53 +0200 |
commit | 2d80cd7840d4a6ac0305c9192fc6a5de43759570 (patch) | |
tree | c4a9c650ea7fd32c61859010d2e64318af710156 /src/script.h | |
parent | 61c85a2b2081dffaf45eb8c6b7754b8d9a80c60d (diff) | |
download | redis-2d80cd7840d4a6ac0305c9192fc6a5de43759570.tar.gz |
Reintroduce lua argument cache in luaRedisGenericCommand removed in v7.0 (#11541)
This mechanism aims to reduce calls to malloc and free when
preparing the arguments the script sends to redis commands.
This is a mechanism was originally implemented in 48c49c4
and 4f68655, and was removed in #10220 (thinking it's not needed
and that it has no impact), but it now turns out it was wrong, and it
indeed provides some 5% performance improvement.
The implementation is a little bit too simplistic, it assumes consecutive
calls use the same size in the same arg index, but that's arguably
sufficient since it's only aimed at caching very small things.
We could even consider always pre-allocating args to the full
LUA_CMD_OBJCACHE_MAX_LEN (64 bytes) rather than the right size for the argument,
that would increase the chance they'll be able to be re-used.
But in some way this is already happening since we're using
sdsalloc, which in turn uses s_malloc_usable and takes ownership
of the full side of the allocation, so we are padded to the allocator
bucket size.
Co-authored-by: Oran Agra <oran@redislabs.com>
Co-authored-by: sundb <sundbcn@gmail.com>
Diffstat (limited to 'src/script.h')
-rw-r--r-- | src/script.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script.h b/src/script.h index b601342c5..b892637ff 100644 --- a/src/script.h +++ b/src/script.h @@ -98,7 +98,7 @@ int scriptPrepareForRun(scriptRunCtx *r_ctx, client *engine_client, client *call void scriptResetRun(scriptRunCtx *r_ctx); int scriptSetResp(scriptRunCtx *r_ctx, int resp); int scriptSetRepl(scriptRunCtx *r_ctx, int repl); -void scriptCall(scriptRunCtx *r_ctx, robj **argv, int argc, sds *err); +void scriptCall(scriptRunCtx *r_ctx, sds *err); int scriptInterrupt(scriptRunCtx *r_ctx); void scriptKill(client *c, int is_eval); int scriptIsRunning(); |