trie benchmark for the "longest prefix match" problem.
To generate time performance data (install pytrie, trie, datrie, SuffixTree or remove them from comparison):
$ ./benchmark.py --prefix nosw3_
To plot the data (install numpy/matplotlib):
$ make-figures.py --plot-only --prefix nosw3_
see make-figures.py
Or to combine both with a auto-generated date-based prefix:
$ ./run.sh
See results Performance comparison suffixtree vs. pytrie vs. trie vs. datrie vs. startswith -functions.
The code for longest_match*
functions in longest_match.py
is taken
from the SO question and its
answers. The rest is also CC
BY-SA 3.0