preshed
Cython hash table that trusts the keys are pre-hashed
Decision gist · record as of 2026-08-14
Yes. Preshed is worth installing if you need high-performance integer-keyed hash tables or Bloom filters in Python or Cython code. It is actively maintained, has no security vulnerabilities, uses a permissive MIT license, and offers prebuilt wheels for easy installation. Medium install friction is manageable; consider it essential for NLP, data processing, or performance-critical applications where standard dicts are insufficient.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or newer; prebuilt wheels available but source builds need a C compiler and Cython.
- Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.9–3.14 across macOS, Linux, Windows, and ARM platforms.
- Active maintenance with a recent release and no known vulnerabilities.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or proprietary projects.
last release 2026-03-23 (144 days) · last repo commit 2026-03-27 · 88 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 21,706,952 downloads/mo, #993 on PyPI
Alternatives
Verify before relying
pip install preshed
from preshed.maps import PreshMap
map = PreshMap()
map[key] = value
value = map[key]- Whether the C API and PreshCounter class are thread-safe without external synchronization in free-threaded Python 3.14+.
- Performance benchmarks comparing preshed to standard dict or other hash table libraries in typical workloads.
- Whether cymem and murmurhash have their own dependencies or platform constraints that affect installation.
What it is and what it does
Preshed is a Cython-based hash table library optimized for lookups on pre-randomized integer keys. It provides three main data structures: PreshMap (a hash map for uint64-to-uint64 mapping), BloomFilter (a probabilistic set for fast membership testing with tunable false-positive rates), and PreshCounter (a frequency counter with Good-Turing smoothing). The library is designed for scenarios where keys are already hashed or randomized, avoiding the overhead of repeated hashing. All Python APIs are thread-safe on both standard and free-threaded Python 3.14+; the C API and PreshCounter require external synchronization in multithreaded contexts.
The package depends on cymem and murmurhash, and exposes both Python and Cython-level APIs. It supports Python 3.9 through 3.14 with prebuilt wheels for common platforms, making installation straightforward for most users. The library is actively maintained and has no known security vulnerabilities.
Use it for
- Building fast lookup tables in NLP pipelines where token IDs or word hashes are already pre-computed.
- Implementing probabilistic data structures for approximate membership testing in memory-constrained applications.
- Counting term or event frequencies in streaming or batch processing with optional Good-Turing probability smoothing.
- Cython extension development requiring low-level hash table access without GIL contention for performance-critical loops.
- Storing and retrieving large volumes of integer-keyed data where standard Python dicts are too slow or memory-heavy.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Preshed is worth installing if you need high-performance integer-keyed hash tables or Bloom filters in Python or Cython code. It is actively maintained, has no security vulnerabilities, uses a permissive MIT license, and offers prebuilt wheels for easy installation. Medium install friction is manageable; consider it essential for NLP, data processing, or performance-critical applications where standard dicts are insufficient.
Install
preshed on PyPI
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.9–3.14 across macOS, Linux, Windows, and ARM platforms. Active maintenance with a recent release and no known vulnerabilities.
Requires Python 3.9 or newer; prebuilt wheels available but source builds need a C compiler and Cython.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or proprietary projects.
Quickstart
pip install preshed
from preshed.maps import PreshMap
map = PreshMap()
map[key] = value
value = map[key]
Verify before relying
- Whether the C API and PreshCounter class are thread-safe without external synchronization in free-threaded Python 3.14+.
- Performance benchmarks comparing preshed to standard dict or other hash table libraries in typical workloads.
- Whether cymem and murmurhash have their own dependencies or platform constraints that affect installation.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release <3.15,>=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 2 packagescymemmurmurhash |
| Maintenance | Actively maintained 144 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 21,706,952 / month, #993 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: CythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Free Threading :: 2 - BetaTopic :: Scientific/Engineering |
Evidence: preshed-3.0.13-cp310-cp310-macosx_10_9_x86_64.whl; preshed-3.0.13-cp310-cp310-macosx_11_0_arm64.whl; preshed-3.0.13-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; preshed-3.0.13-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; preshed-3.0.13-cp310-cp310-musllinux_1_2_aarch64.whl; preshed-3.0.13-cp310-cp310-musllinux_1_2_x86_64.whl; preshed-3.0.13-cp310-cp310-win_amd64.whl; preshed-3.0.13-cp310-cp310-win_arm64.whl; preshed-3.0.13-cp311-cp311-macosx_10_9_x86_64.whl; preshed-3.0.13-cp311-cp311-macosx_11_0_arm64.whl; preshed-3.0.13-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; preshed-3.0.13-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; preshed-3.0.13-cp311-cp311-musllinux_1_2_aarch64.whl; preshed-3.0.13-cp311-cp311-musllinux_1_2_x86_64.whl; preshed-3.0.13-cp311-cp311-win_amd64.whl; preshed-3.0.13-cp311-cp311-win_arm64.whl; preshed-3.0.13-cp312-cp312-macosx_10_13_x86_64.whl; preshed-3.0.13-cp312-cp312-macosx_11_0_arm64.whl; preshed-3.0.13-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; preshed-3.0.13-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pre-hashed key mapping”
- preshedPreshed provides high-performance Cython hash tables for mapping…
- multi_key_dictA dictionary that maps multiple keys to the same value, allowing you…
- MultiMappingMultiMapping provides special mapping objects used internally by…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also bloom-filter2 · pybloom-live · eth-bloom · rbloom · cymem · murmurhash · mmhash3 · immutables · bbhash · mmh3