Home

Awesome

Survey of Skip List Implementations

Here is a brief summary of skip list packages available in Go that you may consider using after a quick Google/Github search. If you know of any others, please contact me so I can add them here.

Some things most of the packages have in common:

Here are some brief notes on each implementation:

Benchmarks

Running the benchmarks found in this repo locally is easy:

go get github.com/sean-public/skiplist-survey
go install github.com/sean-public/skiplist-survey
skiplist-survey > output.csv

The results are in CSV format for easy charting and analysis.

Here is a summary of results I recorded on a Dell Precision with a 2.2 GHz Intel Core i7 (2720QM) and 8GB RAM. It takes over an hour to run all the benchmarks.

The vertical axis is nanoseconds per operation, the horizontal is the number of items in the list.

best inserts chart Best-case insert. These are the "best" inserts because they happen at the front of the list, which shouldn't require any searching. The difference in speed here demonstrates the overhead each package introduces in even the most basic operations.

worst inserts chart Worst-case inserts. These inserts are at the end of the list, requiring searching all the way to the end and then adding the new node. Even though all implementations only show a small variance even after millions of nodes are added, we can still see very large differences in overall speed because of implementation overhead.

random inserts chart Random inserts. The inserts are at random positions in the skiplist, making this the closest real-world case for inserts. The approximately logarithmic behaviour is clearly visible for all implementations even though the overhead makes ryszard take 3x as long as mauriceGit (mt).

average search chart Average search speed. mtchavez, sean and mauriceGit (mt) are approximately equally fast. zhenjl seems to introduce some serious overhead, making it more than 8x as slow as the fastest implementations.

worst case delete chart Worst case deletions. In this benchmark, a skip list of a given length is created and then every item is removed, starting from the last one and moving to the front. mauriceGit (mt) and sean are around equally fast with around 100ns faster than the next contestant (huandu).

random delete chart Random deletions. Elements are removed from random positions in the skiplist. For Deletions, this is the closest to a real-world case. We can clearly see the the logarithmic behaviour, even though some implementations have a large overhead involved. Just like for randomInserts, mauriceGit (mt) is the fastest, closely followed by sean.

Todo