Metadata-Version: 2.3
Name: crabtree
Version: 0.0.0
Summary: Add your description here
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# python-rust-intervaltree

Blazing fast interval tree implementation in Rust for Python

## Setup

```bash
mise use uv
mise use rust
uv run pytest -k compare  # Run comparison test suite
```

## Build for development

Whenever you update the Rust implementation:

```bash
uv run maturin develop
uv run pytest tests
```

## Benchmark

```bash
uv run pytest benchmark --benchmark-columns="mean, stddev, ops"
```


```
--------------------------------------- benchmark 'add': 2 tests ---------------------------------------
Name (time in ns)         Mean              StdDev            OPS (Mops/s)            Rounds  Iterations
--------------------------------------------------------------------------------------------------------
test_crabtree         108.2486 (1.0)        5.7141 (1.0)            9.2380 (1.0)       94118         100
test_intervaltree     591.4424 (5.46)     219.7266 (38.45)          1.6908 (0.18)     102135           1
--------------------------------------------------------------------------------------------------------
```

```
-------------------------------------- benchmark 'at': 2 tests ---------------------------------------
Name (time in us)         Mean            StdDev            OPS (Kops/s)            Rounds  Iterations
------------------------------------------------------------------------------------------------------
test_crabtree          32.9287 (1.0)      2.1191 (1.0)           30.3687 (1.0)       23599           1
test_intervaltree     140.2424 (4.26)     5.6647 (2.67)           7.1305 (0.23)       5857           1
------------------------------------------------------------------------------------------------------
```

```
------------------------------- benchmark 'instanciation': 2 tests ------------------------------
Name (time in ms)        Mean            StdDev                 OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------
test_crabtree          1.5824 (1.0)      0.0521 (1.0)      631.9484 (1.0)         589           1
test_intervaltree     48.3733 (30.57)    1.2204 (23.44)     20.6726 (0.03)         21           1
-------------------------------------------------------------------------------------------------
```

```
---------------------------------- benchmark 'merge_overlaps': 2 tests -----------------------------------
Name (time in ns)           Mean              StdDev            OPS (Kops/s)            Rounds  Iterations
----------------------------------------------------------------------------------------------------------
test_crabtree            78.6891 (1.0)       14.6320 (1.0)       12,708.2331 (1.0)         736           1
test_intervaltree     5,927.3480 (75.33)    989.6877 (67.64)        168.7095 (0.01)         43           1
----------------------------------------------------------------------------------------------------------
```

```
----------------------------------- benchmark 'overlap': 2 tests -----------------------------------
Name (time in ms)           Mean            StdDev                 OPS            Rounds  Iterations
----------------------------------------------------------------------------------------------------
test_crabtree             2.7506 (1.0)      0.0407 (1.0)      363.5539 (1.0)         356           1
test_intervaltree     2,152.4318 (782.53)   2.8911 (71.04)      0.4646 (0.00)          5           1
----------------------------------------------------------------------------------------------------
```

```
-------------------------------- benchmark 'overlaps_interval': 2 tests -------------------------------
Name (time in ns)         Mean             StdDev            OPS (Mops/s)            Rounds  Iterations
-------------------------------------------------------------------------------------------------------
test_crabtree          70.6958 (1.0)       4.7965 (1.0)           14.1451 (1.0)      136352         100
test_intervaltree     544.0188 (7.70)     29.8408 (6.22)           1.8382 (0.13)      77424          20
-------------------------------------------------------------------------------------------------------
```

```
------------------------------------ benchmark 'overlaps_point': 2 tests -------------------------------------
Name (time in ns)             Mean                StdDev            OPS (Kops/s)            Rounds  Iterations
--------------------------------------------------------------------------------------------------------------
test_crabtree              53.7363 (1.0)          6.1619 (1.0)       18,609.3773 (1.0)      190476         100
test_intervaltree     201,367.2773 (>1000.0)  8,738.5716 (>1000.0)        4.9661 (0.00)       4620           1
```
