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 yselivanov
Recipients gvanrossum, vstinner, yselivanov
Date 2016-09-14.20:48:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The attached patch implements an opcode cache for LOAD_GLOBAL opcode, making it 2x faster.

The idea is to use the new co_extra field of code objects & PEP 509 to attach a cache structure pointing directly to the resolved global name.  When globals or builtins are updated, the cache is invalidated.

The patch adds a new file "ceval_cache.h" which provides some infrastructure to ease the pain of implementing new caches for other opcode types.  I can strip down all macros from that file if Victor finds it too hard to review.

Here's a simple script I used to make sure that the cache is working:

You can also set OPCACHE_COLLECT_STATS to 1 to get debug stats output for the cache.
Date User Action Args
2016-09-14 20:48:01yselivanovsetrecipients: + yselivanov, gvanrossum, vstinner
2016-09-14 20:48:00yselivanovsetmessageid: <>
2016-09-14 20:48:00yselivanovlinkissue28158 messages
2016-09-14 20:48:00yselivanovcreate