Question about pypy rpython and jitlogs

Hi, I'm not sure that's the best place to ask questions, but I couldn't find other mediums or documentation. I have a question regarding pypy jit logs: Sometimes when I run an RPython program that runs very quickly, I don't get any jit logs produced, but when I intentionally increase the execution time (by adding more loops, for example), I do get the logs. What is the mechanics behind jit logs? Is there some kind of a hot threshold that needs to be reached? Where can I read more about it? My stack overflow question from a couple of weeks ago: https://stackoverflow.com/questions/73665618/rpython-jit-logs noredirect=1#comment130093714_73665618 I moved on from this problem since I was able to produce logs eventually, but I would like to understand what's happening behind the scenes. Thank you, Pavel

I think you are looking for the JIT "threshold" option [1], which can be specified as pypy --jit threshold=200 to get the JIT to consider a loop "hot" after it has been hit 200 times. The default is 1000 Matti [0] https://doc.pypy.org/en/latest/jit_help.html?highlight=trace_eagerness#advan... On 24/9/22 14:04, Pavel Durov wrote:

Hi, On Sat, 24 Sept 2022 at 20:31, Matti Picus <matti.picus@gmail.com> wrote:
Note that doing so will change the performance characteristics of your program. If you just want to understand why short-running programs don't produce any jit log at all, the answer is simply that short-running programs never reach the threshold at which the JIT kicks in and are instead executed fully on the interpreter. This is expected, and it's how JITs work in general. PyPy's JIT has a threshold of 1000, which means that after a loop has run 1000 times, it spends a relatively large amount of time JITting and optimizing that loop in the hope that it will pay off in future execution time. A bientôt, Armin

I think you are looking for the JIT "threshold" option [1], which can be specified as pypy --jit threshold=200 to get the JIT to consider a loop "hot" after it has been hit 200 times. The default is 1000 Matti [0] https://doc.pypy.org/en/latest/jit_help.html?highlight=trace_eagerness#advan... On 24/9/22 14:04, Pavel Durov wrote:

Hi, On Sat, 24 Sept 2022 at 20:31, Matti Picus <matti.picus@gmail.com> wrote:
Note that doing so will change the performance characteristics of your program. If you just want to understand why short-running programs don't produce any jit log at all, the answer is simply that short-running programs never reach the threshold at which the JIT kicks in and are instead executed fully on the interpreter. This is expected, and it's how JITs work in general. PyPy's JIT has a threshold of 1000, which means that after a loop has run 1000 times, it spends a relatively large amount of time JITting and optimizing that loop in the hope that it will pay off in future execution time. A bientôt, Armin
participants (3)
-
Armin Rigo
-
Matti Picus
-
Pavel Durov