CompactList

Feb 24 2018
CompactList

CompactList implements the List<Long> interface, but internally it uses a tree of variable word-width segments to improve performance and memory usage compared to an ArrayList.

Performance tends to be worse for appends than an ArrayList but better for inserts. Memory usage is significantly reduced, even for incompressible random data where it approaches the memory use of an array of primitive longs (which happens to be the internal representation in this case).

There are some performance metrics over at the GitHub repository. My aim is to use this for the internal index representation in CSView, which already uses an earlier version of this data structure.

Source code at GitHub