You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optimize skiplist query efficiency by embedding the skiplist header (#2867)
Embedding the skiplist header reduces memory jumps, thus optimizing
sorted set query speed.
```
// Before
typedef struct zskiplist {
struct zskiplistNode *header, *tail;
unsigned long length;
int level; /* Height of the skiplist. */
} zskiplist;
// After
typedef struct zskiplist {
unsigned long length;
struct zskiplistNode *tail;
/* Since the span at level 0 is always 1 or 0 ,
* this field is instead used for storing the height of the skiplist. */
struct zskiplistLevel {
struct zskiplistNode *forward;
unsigned long span;
} level[ZSKIPLIST_MAXLEVEL];
} zskiplist;
```
---------
Signed-off-by: chzhoo <[email protected]>
0 commit comments