A big flappy cache that never forgets.
Project description
Mamo
Your friendly neighborhood persistent memoization library.
Getting started
pip install mamo
Design
Code changes drive data changes. Especially, with big data, it is highly likely that different calls return different data.
Mamo fingerprints data by hashing it when unavoidable and by fingerprinting the computational graph (as far as known to Mamo) otherwise.
As future extension, Mamo will support different fingerprints for the same value, but in common use-cases detecting code changes is more impactful.
It assumes functions are pure, which allows for ignoring stochasticity. Otherwise anything using a random number generator would constantly be marked as stale.
More details
Mamo has concepts: value identity and fingerprints. Fingerprints are used to determine whether a stored computed value is stale: If an argument value to the function that computes a value is different (different fingerprints) from the one that was used originally, we mark the value as stale.
Value identity is about when two values have the same identity. (If every value was unique, there would never be stale values.) This is only an important concept for computed values: the result of a function with the same arguments (argument identity) has the same value identity as the stored result for a previous call.
Assumptions
The biggest assumption for the current design is:
Values are unlikely to ever be the same.
This means that we can use hashing for checking equality checks, and that different computational graphs imply unequal values.
Thus, Mamo does not implement perfect memoization at the moment but only a heuristic that does not try to actually match arguments fully.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mamo-0.1.2.tar.gz
.
File metadata
- Download URL: mamo-0.1.2.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b3449afb409151d66ad5a7074e96b6c794e38e13437572ea784497dd468bacb |
|
MD5 | a7f4e1d8663638b5c2b2c73c032b303f |
|
BLAKE2b-256 | 2700e4459d8db584a381d331da39097914e4f9b673e0f454905f26ad5a62a25d |
File details
Details for the file mamo-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: mamo-0.1.2-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1200d85acfd1a88da939d7aa8e3a8d8337b9e7ec7a41ed59145e909030a58feb |
|
MD5 | 19925b6d4e7a8c1f0645d6237820e7cf |
|
BLAKE2b-256 | 596a6f49bdf334f721585005fc9b566307d318430c1172e309386ff94850c75b |