Skip to content

Releases: subpath/weighted_trie

v0.2.0

08 Jan 17:58
b8dea6d

Choose a tag to compare

Full Changelog: v0.1.4...v0.2.0

Optimizations

  • String interning: Each word stored once, nodes use indices
  • Packed suggestions: Weight+index packed into u64 (bit manipulation)
  • compact_str: 12-byte strings vs 24-byte std String
  • SmallVec: Stack allocation for small collections (≤2 suggestions, ≤4 children)
  • Arena allocation: All nodes in Vec, use indices instead of Box pointers
  • hashbrown HashMap: Faster than std HashMap
  • Pre-allocation: Vec capacity = words × 2 (avoids reallocations)
  • shrink_to_fit: Removes over-allocation after build
  • Top-K limiting: 10 suggestions per node max
  • Deduplication: Automatic on insert

Benchmarks

Performance

Single insert:           272 ns
Lookup (per query):      244 ns
Build (100K words):      33.7 ms
Insert 100K (incremental): 32.6 ms

Memory Footprint

Dataset      Memory      Bytes/Word
------------------------------------
10K          2.4 MB      254
50K          13.0 MB     273
100K         29.5 MB     309
500K         130.8 MB    274
1M           231.4 MB    243

v0.1.4

01 Apr 19:28

Choose a tag to compare

Almost 3x speedup in lookup time 🚀

Full Changelog: v0.1.3...v0.1.4

v0.1.3

18 Feb 13:01

Choose a tag to compare

What's Changed

  • add build to WeightedTrie by @sa- in #1

New Contributors

  • @sa- made their first contribution in #1

Full Changelog: v0.1.2...v0.1.3

v0.1.2

12 Feb 19:31

Choose a tag to compare

Full Changelog: v0.1.1...v0.1.2

v0.1.1

11 Feb 17:09

Choose a tag to compare

Full Changelog: v0.1.0...v0.1.1

v0.1.0

11 Feb 16:45

Choose a tag to compare