summaryrefslogtreecommitdiff
path: root/src/quicklist.c
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2020-09-08 15:51:20 +0300
committerOran Agra <oran@redislabs.com>2020-12-06 14:54:34 +0200
commite288430c05359706bcb0f78730af2997ab0db07f (patch)
treef164e852d7661ddfa50b0ff660a08d44cd4ef4f4 /src/quicklist.c
parent7ca00d694d44be13a3ff9ff1c96b49222ac9463b (diff)
downloadredis-e288430c05359706bcb0f78730af2997ab0db07f.tar.gz
Sanitize dump payload: performance optimizations and tuning
First, if the ziplist header is surely inside the ziplist, do fast path decoding rather than the careful one. In that case, streamline the encoding if-else chain to be executed only once, and the encoding validity tested at the end. encourage inlining likely / unlikely hints for speculative execution Assertion used _exit(1) to tell the compiler that the code after them is not reachable and get rid of warnings. But in some cases assertions are placed inside tight loops, and any piece of code in them can slow down execution (code cache and other reasons), instead using either abort() or better yet, unreachable builtin.
Diffstat (limited to 'src/quicklist.c')
-rw-r--r--src/quicklist.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/quicklist.c b/src/quicklist.c
index 8d68aa9ae..5ed9b6a5d 100644
--- a/src/quicklist.c
+++ b/src/quicklist.c
@@ -31,6 +31,7 @@
#include <string.h> /* for memcpy */
#include "quicklist.h"
#include "zmalloc.h"
+#include "config.h"
#include "ziplist.h"
#include "util.h" /* for ll2string */
#include "lzf.h"
@@ -88,14 +89,6 @@ void _quicklistBookmarkDelete(quicklist *ql, quicklistBookmark *bm);
(e)->sz = 0; \
} while (0)
-#if __GNUC__ >= 3
-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#else
-#define likely(x) (x)
-#define unlikely(x) (x)
-#endif
-
/* Create a new quicklist.
* Free with quicklistRelease(). */
quicklist *quicklistCreate(void) {