by panic · 16y ago · 0 comments
http://en.wikipedia.org/wiki/Unrolled_linked_list
The idea is the same as a linked list, but instead of just one element in each node, it stores an entire array. This simple change fixes the two biggest problems with linked lists — memory overhead and cache efficiency. It's also easy to tweak to be more "array-like" or more "list-like" as needed.
http://www.python.org/dev/peps/pep-3128/
The BList is similar to a B+Tree. It was meant to act like an array for small lists, but to make operations like append, concatenation, and slicing faster. It was a pretty cool combination of arrays (for memory compactness and good cache performance and small constant factors) with trees, for the asymptotic improvements they can bring.
Sadly, it didn't take off, as it would have broken backward compatibility with extension modules.
(I don't know offhand if any widely used ones currently do, though.)
However, it's possible that clojure uses this layout for arrays and a different ones for lists or other sequences.
http://blog.higher-order.net/2009/02/01/understanding-clojur...