Tool:New ultrafast interval tree implementation for Python: kerneltree
0
3
Entering edit mode
6.0 years ago
endrebak ▴ 960

https://github.com/endrebak/kerneltree

Ultrafast interval tree implementation stolen from the kernel, modified and wrapped for Python.

Currently the nodes only store (start, end, int), so if you need to store additional data you need to create an int -> val hash.

For a sane number of intervals, the other Python and Cython implementations are going to be plenty fast enough.

Timings:

1 mill values

Python based intervaltrees took 01 minutes and 37 seconds to build the tree. 
Cython based intervaltrees took 00 minutes and 08 seconds to build the tree. 
C based intervaltrees took 00 minutes and 00 seconds to build the tree.

10 mill values

Python based intervaltrees took 16 minutes and 51 seconds to build the tree. 
Cython based intervaltrees took 02 minutes and 10 seconds to build the tree. 
C based intervaltrees took 00 minutes and 17 seconds to build the tree. 
C based intervaltrees took 00 minutes and 14 seconds to build the tree using 
the helper function build.

Bug reports and such welcome.

Interval-tree Python • 7.9k views
ADD COMMENT
0
Entering edit mode

Use https://github.com/hunt-genes/ncls instead. It is much faster :)

ADD REPLY

Login before adding your answer.

Traffic: 3119 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6