[Python-3000] Performance Notes (original) (raw)

Nicholas Bastin nick.bastin at gmail.com
Fri Sep 7 18:29:44 CEST 2007


On 9/3/07, Nicholas Bastin <nick.bastin at gmail.com> wrote:

NOTE: This data is time sampling, not call graph. Added time could come from either more calls, or longer calls.

+312.9% PyDictGetItem

I've finally managed to get call graph data and it's fairly interesting for this call. I try to find some way to post all of the data at some point, but I thought some initial data might be useful.

Calls to PyDict_GetItem in 2.6 (pystone.py 10000):

160839 - instance_getattr2 30325 - class_lookup 5545 - PyString_InternInPlace 4808 - update_one_slot 2290 - PyObject_GenericGetAttr ... Total: 208697

3.0 (pystone.py 10000):

575093 - PyEval_EvalFrameEx 416600 - PyObject_GenericGetAttr 321447 - PyObject_GenericSetAttr 25394 - update_one_slot 10142 - lookup_maybe 8925 - PyUnicode_InternInPlace ... Total: 1368114

Almost all (522631) of the extra calls in PyEval_EvalFrameEx are because in 2.6 we use the unrolled code in LOAD_GLOBAL, and in 3.0, LOAD_GLOBAL always falls through to PyDict_GetItem.

I haven't investigated GenericGet/SetAttr yet.

-- Nick



More information about the Python-3000 mailing list