r/Python • u/AutoModerator • 21d ago
Showcase Showcase Thread
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
28
Upvotes
r/Python • u/AutoModerator • 21d ago
Post all of your code/projects/showcases/AI slop here.
Recycles once a month.
View all comments
1
u/alexis-jeandet 20d ago
SciQLop Cache: a diskcache-compatible persistent cache with a C++ core, built for big numpy arrays
What My Project Does
pysciqlop-cache is a persistent key-value cache for Python. You store any picklable object under a string key, and any thread or process on the machine can read it back, safely, even at the same time.
Small values live in SQLite. Big ones go to files, which are memory-mapped on read. It has expiration, tags, an optional size limit with LRU eviction, transactions, and a
memoizedecorator.We built it for SciQLop and speasy, tools for space physics data, where a cached value is often a 10 to 100 MB time series. That's where most of the work went:
cache.check(fix=True)repairs what it finds.Target Audience
Anyone who caches expensive results to disk and shares the cache between processes: scientific code, data pipelines, notebooks, worker pools. It's in production in speasy, and it's on PyPI with wheels for Linux, macOS and Windows (x86-64 and ARM).
Comparison
The obvious comparison is diskcache. The API is mostly the same on purpose, and one command migrates an existing diskcache directory:
Benchmarks with both libraries at their default settings, on a RAM filesystem (Ryzen 7 5800X and Apple M2):
Where diskcache wins: values between 8 KB and 32 KB. We store those as files, and diskcache keeps them in SQLite, so our writes are about 1.8x slower in that range on Linux.
Methodology and all the charts: https://sciqlop-cache.readthedocs.io/en/latest/performance.html
Docs: https://sciqlop-cache.readthedocs.io
Feedback welcome, especially on the API and on workloads where it falls short.