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 vstinner
Recipients serhiy.storchaka, vstinner
Date 2015-11-05.10:11:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446718279.47.0.148828829851.issue25557@psf.upfronthosting.co.za>
In-reply-to
Content
The LOAD_GLOBAL bytecode has a fast-path when globals and builtins have exactly the type 'dict'. It calls the _PyDict_LoadGlobal() function.

I propose to implement a similar optimization for LOAD_NAME, see attached patch.

The patch also fixes LOAD_GLOBAL and LOAD_NAME bytecodes when locals, globals or builtins are not exactly the type 'dict'. It clears the KeyError before trying the next PyObject_GetItem().

The patch changes also _PyDict_LoadGlobal() to call PyObject_Hash() if the hash was not computed yet. It might make it a little bit faster.
History
Date User Action Args
2015-11-05 10:11:19vstinnersetrecipients: + vstinner, serhiy.storchaka
2015-11-05 10:11:19vstinnersetmessageid: <1446718279.47.0.148828829851.issue25557@psf.upfronthosting.co.za>
2015-11-05 10:11:19vstinnerlinkissue25557 messages
2015-11-05 10:11:19vstinnercreate