Conversation
|
Hello @sunheehnus, this is in general a good idea, but the skiplist is so easy to navigate and requires so little state that I would make it more like a stack allocated structure and a few macros or alike. The adlist iterator is already a bit like that if you use listRewind(), you just declare an iterator var and iterate, we could do the same? Bonus point if we implement even skiplistNext as macro if possible, otherwise we could make it a small So:
Makes sense? |
Follow antirez's advice in antirez#67 skiplistRewind/skiplistRewindTail changed to macros, skiplistNext changed to an inline func, Iterator should be guaranteed stack allocated and no cleanup need.
|
Hi @antirez ,
It could be more efficient without allocating memory dynamically. |
Hi @antirez ,
I saw that skiplist lacks Iter APIs like dict, adlist etc.
Hope this PR could be helpful. :-)