Fast and simple SumTree implementation in Rust
Project description
SumTree
This module contains a SumTree implementation in Rust with Python wrappers. Speedup is around 10x in comparison to an equivalent full Python implementation.
Check the project on github: https://github.com/yamoling/sumtree
Usage
Initialisation
from sumtree import SumTree
st = SumTree(1024)
st.add(10)
print(st.total) # 10
print(len(st)) # 1
print(st.capacity) # 1024
Sampling data
from sumtree import SumTree
st = SumTree(1024)
for i in range(1024):
st.add(i)
index, value = st.get(500)
print(index, value) # 32, 32.0
Updating data
from sumtree import SumTree
st = SumTree(1024)
for i in range(1024):
st.add(i)
# Set leaf 0 to value 40.
tree.update(0, 40.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sumtree-0.2.0.tar.gz
(7.6 kB
view hashes)
Built Distribution
Close
Hashes for sumtree-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f509d7a4fca6c1e96151d4e333b2da1e98231b7d086b2478a73c13ec21e8e73 |
|
MD5 | 80b32bf0f0c6bf237dac913413e69e8b |
|
BLAKE2b-256 | 7a3c23266168d23aaf2880b53ee2e8340d574ba3c11a4f5cd14b1f5d7a349a18 |