Understand the relationship between cytoolz and toolz
mastercytoolz is a high-performance Cython implementation of the toolz package.
Key characteristics:
- API Compatibility:
cytoolzimplements the exact same API astoolz, making it a drop-in replacement for many use cases. - Performance: It is typically 2-5x faster than the pure Python
toolzimplementation. - C API: Unlike
toolz,cytoolzoffers a C API that can be accessed by other projects developed in Cython. - Memory Efficiency: Like
toolz, it uses the iterator protocol and returns iterators whenever possible to handle large or infinite datasets with low memory usage.
Note on Threading: cytoolz has experimental support for Python free-threading (introduced in Python 3.13) and provides wheels for free-threaded Python. However, it has not been explicitly developed or tested for thread-safety; use it in multi-threaded environments at your own risk.