[pypy-dev] How to turn a crawling caterpillar of a VM into a graceful butterfly

Laurence Tratt laurie at tratt.net
Sun Jan 1 18:13:10 CET 2012

On Sun, Jan 01, 2012 at 07:02:14PM +0200, Maciej Fijalkowski wrote:

>> Here's an example (hopefully a decent one!):
>>  http://pastebin.com/51QpPD7C
> so for example here, tracing has taken 0.8s out of 2.5 total (a lot) + 0.2s
> for the backend.  If you can post some example I can probably look at
> traces.
> For example - is the loop iteration from above a good one?

I don't know if it's a good one or not :) This is a real program executing
under the Converge JIT - the Converge compiler. If you have a checkout of the
Converge VM and have built the VM with a JIT, you can recreate this by doing:

  $ cd compiler
  $ PYPYLOG=jit-summary:stats ../vm/converge convergec -o Compiler/Code_Gen.cvb  Compiler/Code_Gen.cv

> Also, there were 16 loops aborted because trace run out for too long. That
> might mean a lot of things.

I'm going to assume this is because (at least as I've done things so far) the
VM is effectively inlining all calls to RPython-level functions (in other
words, if the bytecode calls a builtin function, the latter is inlined). It's
not clear to me whether this is entirely desireable - sometimes it might be
sensible, but often not. How does PyPy handle this? Does it have a blanket
"don't look inside builtin functions" for example?

Personal                                             http://tratt.net/laurie/
The Converge programming language                      http://convergepl.org/
   https://github.com/ltratt              http://twitter.com/laurencetratt

More information about the pypy-dev mailing list