From: Raymond Hettinger Date: Sun, 20 May 2012 04:20:48 +0000 (-0700) Subject: Minor change to default lru size. Set default to a power of two. X-Git-Tag: v3.3.0a4~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=010ce3283a6989979817ffdb7beb603cb6dabe15;p=python Minor change to default lru size. Set default to a power of two. --- diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 05f97b1bbd..1b0d82a4bf 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -40,7 +40,7 @@ The :mod:`functools` module defines the following functions: .. versionadded:: 3.2 -.. decorator:: lru_cache(maxsize=100, typed=False) +.. decorator:: lru_cache(maxsize=128, typed=False) Decorator to wrap a function with a memoizing callable that saves up to the *maxsize* most recent calls. It can save time when an expensive or I/O bound diff --git a/Lib/functools.py b/Lib/functools.py index 8ef173296d..9f024f14d7 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -166,7 +166,7 @@ class _CacheKey(list): def __hash__(self): return self.hashvalue -def lru_cache(maxsize=100, typed=False): +def lru_cache(maxsize=128, typed=False): """Least-recently-used cache decorator. If *maxsize* is set to None, the LRU features are disabled and the cache