[New-bugs-announce] [issue5730] setdefault speedup
Dan Schult
report at bugs.python.org
Thu Apr 9 21:35:30 CEST 2009
New submission from Dan Schult <dschult at colgate.edu>:
In the depths of dictobject.c one can see that dict_setdefault uses two
identical calls to PyObject_Hash and ma_lookup. The first to see if the
item is in the dict, the second (only if key is not present) to add the
item to the dict.
This second lookup (and hash) are not needed and can be avoided by
inlining a portion of PyDict_SetItem instead of calling the entire
subroutine.
----------
components: Interpreter Core
messages: 85824
nosy: dschult
severity: normal
status: open
title: setdefault speedup
type: performance
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5730>
_______________________________________
More information about the New-bugs-announce
mailing list