This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dschult
Recipients dschult
Date 2009-04-09.19:35:28
SpamBayes Score 1.2484415e-05
Marked as misclassified No
Message-id <1239305730.8.0.484085764135.issue5730@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-04-09 19:35:30dschultsetrecipients: + dschult
2009-04-09 19:35:30dschultsetmessageid: <1239305730.8.0.484085764135.issue5730@psf.upfronthosting.co.za>
2009-04-09 19:35:29dschultlinkissue5730 messages
2009-04-09 19:35:29dschultcreate