You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Caching the tuple hash calculation speeds up some code significantly #131525
Back in 2013, it was determined that caching the result of tuple_hash did not have any significant speedup.
However, a lot has changed since then, and in a recent experiment to add a tuple hash cache back in, the mdp benchmark increased by 86%.
Admittedly, there was no measurable improvement on any other benchmark, but it also seems to have no downside, including for memory usage when measured with max_rss.
This would nicely simplify and speed-up the pure python implementation of lru_cache. The _HashedSeq class would no longer be needed, and a plain tuple would suffice.
Activity
pythongh-131525: Cache the result of tuple_hash
pythongh-131525: Cache the result of tuple_hash
rhettinger commentedon Mar 20, 2025
This would nicely simplify and speed-up the pure python implementation of
lru_cache. The_HashedSeqclass would no longer be needed, and a plain tuple would suffice.gh-131525: Cache the result of tuple_hash (#131529)
pythongh-131525: Remove `_HashedSeq` wrapper from `lru_cache`
pythongh-131525: Remove `_HashedSeq` wrapper from `lru_cache`
gh-131525: Remove `_HashedSeq` wrapper from `lru_cache` (gh-131922)
pythongh-131525: Cache the result of tuple_hash (python#131529)
erlend-aasland commentedon May 14, 2025
Is there more work to be done here?