[issue1568] PATCH: Armin's attribute lookup caching for 3.0

Neil Toronto report at bugs.python.org
Fri Dec 7 14:28:17 CET 2007

New submission from Neil Toronto:

This is a half-port of the patches in #1685986 and #1700288 to Python
3.0. Speedups are about the same as in those patches applied to their
respective Python versions for minibenchmarks (included in the patch as
fastattr_test_py3k.py): 5%-30% or more depending on how deep the class
hierarchy is. Pybench takes 4% less time on my system, and pystone takes
6% less time.

(Pybench would do better, but SpecialClassAttribute runs long and spends
half its time setting class attributes.)

The main difference between this and the previous patches is that 3.0's
simplifications allow a smaller footprint and make it easier to analyze
its correctness. Specifically, the fact that every object in the MRO
must be a type allows us to assume that every attribute lookup is
cacheable, and allows integration into the update_subclasses mechanism
when attributes are set. The lack of compiled extension modules means
there is no flag to check to see whether a type object supports caching.

components: Interpreter Core
files: python30-attrcache.diff
messages: 58274
nosy: ntoronto
severity: normal
status: open
title: PATCH: Armin's attribute lookup caching for 3.0
type: rfe
versions: Python 3.0
Added file: http://bugs.python.org/file8889/python30-attrcache.diff

Tracker <report at bugs.python.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python30-attrcache.diff
Type: text/x-patch
Size: 20964 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-bugs-list/attachments/20071207/2318f032/attachment-0001.bin 

More information about the Python-bugs-list mailing list