链表在 // 链表节点 struct listNode<T> { listNode *prev; listNode *next; T value; } listNode; // 链表 struct list { listNode *head; // 表头指针 listNode *tail; // 表尾指针 long len; // 链表长度 } list; 对于链表,有以下特性:
快速列表使用链表的附加空间相对太高,因为 考虑到链表的以上缺点, // 快速列表节点 struct quicklistNode { quicklistNode *prev; quicklistNode *next; ziplist *zl; // 指向压缩列表 int32 size; // ziplist字节总数 int16 count; // ziplist中元素数量 int2 encoding; // 存储形式,表示原生字节数组还是LZF压缩存储 ... } quicklistNode; // 快速列表 struct quicklist { quicklistNode *head; quicklistNode *next; long count; // 元素总数 int nodes; // ziplist节点个数 int compressDepth; // LZF算法压缩深度 } quicklist; 从代码可以看出,
在 默认情况下, 为支持快速 |
|