From 2c74f66e796d5362f1cbd16b1658b3e48b2bb2ad Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 28 Sep 2017 18:12:15 +0200 Subject: [PATCH] Streams: reduce listpack max size to 2k to speedup range queries. Listpack max size is a tradeoff between space and time. A 2k max entry puts the memory usage approximately at a similar order of magnitude (5 million entries went from 96 to 120 MB), but the range queries speed doubled (because there are half entries to scan in the average case). Lower values could be considered, or maybe this parameter should be made tunable. --- src/t_stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t_stream.c b/src/t_stream.c index 00d07ac57..956a9af1b 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -31,7 +31,7 @@ #include "endianconv.h" #include "stream.h" -#define STREAM_BYTES_PER_LISTPACK 4096 +#define STREAM_BYTES_PER_LISTPACK 2048 /* Every stream item inside the listpack, has a flags field that is used to * mark the entry as deleted, or having the same field as the "master"