[pypy-dev] Preheating pypy

Matt Billenstein matt at vazor.com
Wed Mar 21 18:55:38 EDT 2018


Yeah, not very clean, but you could run dummy queries there that just exercised
the hot code paths.

It would be interesting to see if it worked though -- have a function that runs
much faster after jit, warm it like this, then see if behaves the same after
gunicorn forks the worker process.

m

On Wed, Mar 21, 2018 at 09:06:20AM +0100, Nagy, Attila wrote:
> On 03/18/2018 11:14 PM, Matt Billenstein wrote:
> > Seems you need to just trigger whatever heuristic causes the JIT to run on the
> > interesting codepaths during application startup.
> > 
> > Would having a small for loop in a module global namespace that called down
> > through your stack do the trick?
> > 
> > ===== somemodule.py
> > 
> > def foo(...):
> >      # maybe this function calls through several layers of code in other
> >      # modules...
> >      ...
> > 
> > for i in range(20):
> >      foo(...)  # prewarm foo...
> > 
> > =====
> > 
> > 
> That would be hard, I guess. For example I couldn't reach the processing
> layer of a connection object this way, only with real queries.

-- 
Matt Billenstein
matt at vazor.com
http://www.vazor.com/


More information about the pypy-dev mailing list