Skip to main content

General purpose efficient memoization

Project description

Memoized

The common general versions of memoized decorators ([1], [2], [3]) are often good enough but they incur some overhead that can be avoided in more special cases ([4]). This package exposes a single callable, memoized, that picks an efficient memoization implementation based on the decorated function’s signature and a few user provided options. The included benchmark file gives an idea of the performance characteristics of the different possible implementations.

Additionally, memoized allows:

  • Creating signature preserving decorators (through the decorator module).

  • Passing an external object as the underlying storage (e.g. an LRU cache) instead of a dict that is used by default.

More options for customization and optimization may be added in the future.

News

0.2

  • Add hashable parameter.

  • Make it possible to use @memoized as equivalent of @memoized().

0.1

  • Initial release

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

memoized-0.2.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file memoized-0.2.tar.gz.

File metadata

  • Download URL: memoized-0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for memoized-0.2.tar.gz
Algorithm Hash digest
SHA256 6e71b011f44d0319f328363055d60ff25986e12b45883f6bb7bc1d5a89dc6973
MD5 ab3c44f629e94173f2117fba3eac95b8
BLAKE2b-256 89a67023d603096397c88ca671b8ce1bf986eb7f7df19f5450c171a24f0d923d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page