
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
strstrdict
Advanced tools
Low memory overhead alternative to Python's dict, with string keys and values.
Uses half of the memory of dict for strings of length 40, at the cost of being
half as fast. More improvement at shorter strings, less at longer ones. See more
at benchmarks.
Drop-in replacement for dict with the following limitations:
>>> from strstrdict import StrStrDict
>>> d = StrStrDict()
>>> d['foo'] = 'bar'
>>> d['foo']
'bar'
To KISS, this project only supports a string to string dictionary.
More:
pip install strstrdict
Filling a dictionary with 1m items, key and value strings 5-10 chars long, from a pool of 2m random strings. Then reading values 1m times, with a 50% hit rate.
| Fill time (s) | Read time (s) | Memory (MB) | |
|---|---|---|---|
| dict | 0.19s | 0.17s | 159.60 |
| sqlitedict1 | 10.31s | 51.79s | 69.41 |
| strstrdict | 0.41s | 0.44s | 64.44 |
Filling a dictionary with 1m items, key and value strings 20-30 chars long, from a pool of 2m random strings. Then reading values 1m times, with a 50% hit rate.
| Fill time (s) | Read time (s) | Memory (MB) | |
|---|---|---|---|
| dict | 0.26s | 0.21s | 193.23 |
| sqlitedict1 | 9.17s | 41.09s | 139.40 |
| strstrdict | 0.41s | 0.42s | 95.38 |
Filling a dictionary with 1m items, key and value strings 100-200 chars long, from a pool of 2m random strings. Then reading values 1m times, with a 50% hit rate.
| Fill time (s) | Read time (s) | Memory (MB) | |
|---|---|---|---|
| dict | 0.38s | 0.24s | 447.02 |
| sqlitedict1 | 11.31s | 42.62s | 572.88 |
| strstrdict | 0.76s | 0.56s | 344.73 |
parallel-hashmap for their amazing header-only library!
pysimdjson for a reference how to write a cython lib!
FAQs
lower memory alternative to string-to-string dict
We found that strstrdict demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.