[Python-Dev] Opcode cache in ceval loop (original) (raw)
Sven R. Kunze srkunze at mail.de
Thu Feb 4 11:22:41 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 04.02.2016 16:57, Matthias Bussonnier wrote:
On Feb 3, 2016, at 13:22, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
An ideal way would be to calculate a hit/miss ratio over time for each cached opcode, but that would be an expensive calculation. Do you mean like a sliding windows ? Otherwise if you just want a let's say 20% miss threshold, you increment by 1 on hit, and decrement by 4 on miss.
Division is expensive.
On Feb 3, 2016, at 13:37, Sven R. Kunze <srkunze at mail.de> wrote:
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) Min might be overkill, maybe you can use a or mask, to limit the windows range to 256 consecutive call ?
Sure, that is how I would have written it in Python. But I would suggest an AND mask. ;-)
Best, Sven
- 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 ]