Hi Vasily,

Sorry for the delay.

On Mon, Jun 3, 2013 at 12:08 PM, Vasily Evseenko <[email protected]> wrote:
> When i dynamically create new type (for example classes nested to
> functions) I've got linear code slowdown:

It's a known bug, related to the approach we take for JITting.
Technically, it occurs because we write a guard about the exact class
of 'obj'.  When test() is called the 2nd time, the guard fails, and we
compile a new "bridge" (i.e. a new portion of machine code) that
starts with a guard that the class is, this time, the 2nd version.
This fails again at the next test() call, and so on.  In the end we
have 99 guards that fails (so 99 conditional jumps in machine code)
before we reach the working one.  It basically ends up as a switch,
but a very bad variant of a switch, doing linear search.

This bad case can occur in a lot of situations, but all of them
relatively rare.  We should still improve it.


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to