[Python-Dev] Opcode cache in ceval loop (original) (raw)
Sven R. Kunze srkunze at mail.de
Wed Feb 3 16:37:33 EST 2016
- Previous message (by thread): [Python-Dev] Opcode cache in ceval loop
- Next message (by thread): [Python-Dev] Opcode cache in ceval loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 03.02.2016 22:22, Yury Selivanov wrote:
One way of tackling this is to give each optimized opcode a counter for hit/misses. When we have a "hit" we increment that counter, when it's a miss, we decrement it.
Within a given range, I suppose. Like:
c = min(c+1, 100)
I kind of have something like that right now: https://github.com/1st1/cpython/blob/opcache5/Python/ceval.c#L3035 But I only decrement that counter -- the idea is that LOADATTR is allowed to "miss" only 20 times before getting deoptimized. I'll experiment with inc/dec on hit/miss and see how that affects the performance. An ideal way would be to calculate a hit/miss ratio over time for each cached opcode, but that would be an expensive calculation.
- Previous message (by thread): [Python-Dev] Opcode cache in ceval loop
- Next message (by thread): [Python-Dev] Opcode cache in ceval loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]