Mailing List Archive

cpython: Flatten the lru cache keyword args tuple for better memory utilization.
http://hg.python.org/cpython/rev/399cb1afb747
changeset: 76643:399cb1afb747
user: Raymond Hettinger <python@rcn.com>
date: Sun Apr 29 12:28:02 2012 -0700
summary:
Flatten the lru cache keyword args tuple for better memory utilization.

files:
Lib/functools.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Lib/functools.py b/Lib/functools.py
--- a/Lib/functools.py
+++ b/Lib/functools.py
@@ -185,7 +185,9 @@
key = args
if kwds:
sorted_items = tuple(sorted(kwds.items()))
- key += kwd_mark + sorted_items
+ key += kwd_mark
+ key += tuple(k for k, v in sorted_items)
+ key += tuple(v for k, v in sorted_items)
if typed:
key += tuple(type(v) for v in args)
if kwds:

--
Repository URL: http://hg.python.org/cpython