3 ms·
True, but not quite. The first thing zrange does is look for the starting point, which is an approximately O(log(N)) for a skiplist (which is how it's implement
by gtrubetskoy 14y ago
True, but not quite. The first thing zrange does is look for the starting point, which is an approximately O(log(N)) for a skiplist (which is how it's implemented). An iterator's next() operation should be O(1). If I need to iterate over a gazillion elements, it would make a huge difference. Or course you could zrange chunks, and it would be more efficient, but what's wrong with a simple START and NEXT semantic?
BUT this is all a moot point - a Sorted Set is not the type of structure that something like SQLite4 needs anyway. The keys should be sorted lexicographically, not by score. I think a Skip List fits the bill perfectly, and Redis already contains an implementation of it (as part of Sorted Sets), why not expose it as a standalone type?
- deleted 14y ago[deleted]