[pypy-dev] Re: [pypy-svn] r21163 - pypy/dist/pypy/translator/backendopt

Carl Friedrich Bolz cfbolz at gmx.de
Thu Dec 15 10:35:00 CET 2005


Hi Armin!

Armin Rigo wrote:
> On Wed, Dec 14, 2005 at 11:40:23PM +0100, cfbolz at codespeak.net wrote:
> 
>>Modified:
>>   pypy/dist/pypy/translator/backendopt/inline.py
>>Log:
>>make functions that are called exactly once more likely to get inlined.
> 
> 
> I'm concerned about functions that look like:
> 
> def _ll_list_resize_ge(l, newsize):
>     if len(l.items) >= newsize:
>         l.length = newsize
>     else:
>         _ll_list_resize_really(l, newsize)
> 
> It's a stub that we would like to see inlined in its many callers, but
> the _ll_list_resize_really() should not be inlined.  With your new
> weighting formula, it's likely that _ll_list_resize_really() would get
> inlined into _ll_list_resize_ge() first, and then the intended effect is
> lost.  (The example is not good because _ll_list_resize_really() is
> actually called from two other places as well...  it's just an example).
 >
> Maybe it would be better to do two independent passes in
> auto_inlining(): with the old formula, and then once again --
> recomputing the callers/callees as well -- with the modified formula
> favoring functions that are *still* called only once.

I agree. I did this checkin mostly because I wanted the new inlining 
tested on snake, since my own machine gave incoherent results. I should 
have made that more clear. On the other hand, with the new inlining we 
seem to get a slight speedup (from 9.22x to 8.31x slower than CPython on 
pystone, from 8.15x to 8.16x slower than CPython with Richards), so 
maybe we can get even more when doing this with your proposed method.

Cheers,

Carl Friedrich



More information about the Pypy-dev mailing list