[Python-Dev] Opcode cache in ceval loop (original) (raw)

Matthias Bussonnier bussonniermatthias at gmail.com
Thu Feb 4 10:57:52 EST 2016


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.

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 ?

M

Yury


Python-Dev mailing list Python-Dev at python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/bussonniermatthias%40gmail.com



More information about the Python-Dev mailing list