[Python-Dev] Opcode cache in ceval loop

Yury Selivanov yselivanov.ml at gmail.com
Mon Feb 1 15:35:21 EST 2016



On 2016-02-01 3:27 PM, Sven R. Kunze wrote:
> On 01.02.2016 20:51, Yury Selivanov wrote:
>> If LOAD_ATTR gets too many cache misses (20 in my current patch) it 
>> gets deoptimized, and the default implementation is used.  So if the 
>> code is very dynamic - there's no improvement, but no performance 
>> penalty either.
>
> Will you re-try optimizing it?

No.

It's important to understand that if we have a lot of cache misses after 
the code object was executed 1000 times, it doesn't make sense to keep 
trying to update that cache.  It just means that the code, in that 
particular point, works with different kinds of objects. FWIW, I 
experimented with different ideas (one is to never de-optimize), and the 
current strategy works best on the vast number of benchmarks.

Yury


More information about the Python-Dev mailing list