Show HN: ZDS – Zig Data Structures
4 months ago
- #Zig
- #Performance
- #Data Structures
- High-performance data structures for Zig, not thread-safe by default.
- Includes SwissMap (SIMD-optimized hash map), RBTree (Red-Black Tree), RadixTree, LRUCache, and B-Tree.
- SwissMap outperforms std.AutoHashMap in benchmarks, especially for insertions and deletions.
- RBTree is optimized for maintaining sorted order, significantly faster than sorted ArrayList for large datasets.
- RadixTree excels at prefix-based storage and retrieval, with efficient structure sharing.
- LRUCache combines SwissMap for O(1) access with a DoublyLinkedList for O(1) eviction.
- B-Tree is balanced for minimizing disk/memory accesses, with configurable node sizes.
- Benchmarks show performance advantages of zds structures over standard alternatives.