Message276485
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: https://gist.github.com/1st1/a9660aabdcf6b8bc6205b9fe39a82bba
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:01 | yselivanov | set | recipients:
+ yselivanov, gvanrossum, vstinner |
2016-09-14 20:48:00 | yselivanov | set | messageid: <1473886080.87.0.000411119678127.issue28158@psf.upfronthosting.co.za> |
2016-09-14 20:48:00 | yselivanov | link | issue28158 messages |
2016-09-14 20:48:00 | yselivanov | create | |
|