Benchmarks

All benchmarks are done on a laptop with Intel Core i7-7700HQ CPU and 16GB of RAM.

Since this package is an implementation of the Java TreeMap, the benchmarks are focused on comparing the performance between this package and Java’s TreeMap.

This package is currently written in pure Python and it should come as no surprise that it is much slower than Java, especially when the size of the tree is large.

Note

A Cython version is in the works.

Benchmark procedure:

  1. Prepare \(n\) entries with distinct keys. (\(n\) ranges from 1000 to 60000 with 1000 interval.)

  2. Insert/Remove/Search them into the map in random order and record the completion time.

  3. Repeat step 1-2 two more times and average the result.

Here is result using Java TreeMap:

_images/java.png

And here is the result using pytreemap:

_images/pytreemap.png

Overlay the plots together, we can see that pytreemap is ~30x slower:

_images/java_vs_pytreemap.png