Developer builds frozndict, a fast immutable hashable dictionary for Python and Node.js

A developer has released frozndict, an immutable, insertion-ordered, hashable dictionary implemented in safe Rust with bindings for Python and Node.js. The library addresses a long-standing gap in Python's standard library, where dicts cannot be used as cache keys or function arguments requiring hashability. frozndict computes its hash once at construction time for O(1) lookups and offers O(1) copy operations by returning a shared Arc pointer rather than duplicating data. Benchmarks on Python 3.12.3 show frozndict outperforming existing alternatives like frozendict and immutables.Map in iteration speed and copy performance. Mutation attempts are blocked at the Rust level, raising a TypeError, making the structure reliably immutable by design.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in