diff options
author | uriyage <78144248+uriyage@users.noreply.github.com> | 2023-02-28 19:38:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 19:38:58 +0200 |
commit | 9d336ac398d3a28f6e5e76f1b3b110bab949bcc5 (patch) | |
tree | 0925b307d0459a816ae002a0e569a7c80110675f /src/script_lua.c | |
parent | b1939b052adc058bd814045a745ec02d3f791d7b (diff) | |
download | redis-9d336ac398d3a28f6e5e76f1b3b110bab949bcc5.tar.gz |
Try to trim strings only when applicable (#11817)
As `sdsRemoveFreeSpace` have an impact on performance even if it is a no-op (see details at #11508).
Only call the function when there is a possibility that the string contains free space.
* For strings coming from the network, it's only if they're bigger than PROTO_MBULK_BIG_ARG
* For strings coming from scripts, it's only if they're smaller than LUA_CMD_OBJCACHE_MAX_LEN
* For strings coming from modules, it could be anything.
Co-authored-by: Oran Agra <oran@redislabs.com>
Co-authored-by: sundb <sundbcn@gmail.com>
Diffstat (limited to 'src/script_lua.c')
-rw-r--r-- | src/script_lua.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/script_lua.c b/src/script_lua.c index b44dbc0d5..cf0755e15 100644 --- a/src/script_lua.c +++ b/src/script_lua.c @@ -790,8 +790,6 @@ static robj **lua_argv = NULL; static int lua_argv_size = 0; /* Cache of recently used small arguments to avoid malloc calls. */ -#define LUA_CMD_OBJCACHE_SIZE 32 -#define LUA_CMD_OBJCACHE_MAX_LEN 64 static robj *lua_args_cached_objects[LUA_CMD_OBJCACHE_SIZE]; static size_t lua_args_cached_objects_len[LUA_CMD_OBJCACHE_SIZE]; |