[HN Gopher] Intervaltree with Rust Back End
___________________________________________________________________
Intervaltree with Rust Back End
Author : athekunal
Score : 49 points
Date : 2025-11-02 07:04 UTC (3 days ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| athekunal wrote:
| I built a project that implemented intervaltree in Rust and
| exposed PyO3 bindings as a drop-in replacement for Python's
| native intervaltree. It is significantly faster, and I will be
| adding more features, such as AVL and red-black trees for
| balancing.
| eru wrote:
| If you want balanced trees, have a look at what Rust's standard
| library does with BTreeMap.
| jeffparsons wrote:
| And with a little work you can even use them to map ranges of
| keys to values in a way that's reminiscent of interval trees
| -- e.g. https://crates.io/crates/rangemap. (Disclosure:
| that's my crate.)
| eru wrote:
| Nice! I was only suggesting considering BTrees because they
| also play nice with caches, instead of the more
| conventional binary tree balancing mechanisms.
| airstrike wrote:
| I love that crate! Kudos
| stefanka wrote:
| Will you publish it as a crate too?
| Epa095 wrote:
| What is the native intervaltree, is it [1] you mean? Do you
| also support the set operations? And can it be pickled safely?
|
| 1: https://pypi.org/project/intervaltree/
| 2Pacalypse- wrote:
| Pretty cool to have this in Rust, might be useful if/when I
| decide to move some functionality from TS -> Rust.
|
| In the meantime, I have this impelemented in TypeScript in case
| anyone else will find it useful:
| https://github.com/ShieldBattery/node-interval-tree
| croemer wrote:
| Did you intend this to be a comment on
| https://news.ycombinator.com/item?id=45821737 with the first
| line as a quote?
| griffzhowl wrote:
| The comment you're linking to is younger than the comment
| you're replying to.
|
| Plus, the account of the one you're linking to only has that
| one comment in their comment history. So I think the
| shenanigans lie there
| vswaroop04 wrote:
| Pretty nice to have this in Rust could come in handy if I decide
| to migrate some functionality from TypeScript to Rust later on.
| jonstewart wrote:
| In C++ there's the Boost Interval Container Library, which has an
| excellent API:
| https://www.boost.org/doc/libs/latest/libs/icl/doc/html/inde...
|
| Unfortunately it's implemented on top of std::set/std::map and
| I've had problems with heap blow up on large maps. This project
| looks like it uses 32 bit indices into a vector for backing
| store.
___________________________________________________________________
(page generated 2025-11-05 23:02 UTC)