[pypy-dev] [pypy-commit] pypy reflex-support: Remove elidable_promote that made the translation choke.

wlavrijsen at lbl.gov wlavrijsen at lbl.gov
Thu Aug 25 16:34:42 CEST 2011


Hi Anto,

On Thu, 25 Aug 2011, Antonio Cuni wrote:
>> -    @jit.elidable_promote()
>>       def _get_offset(self, w_cppinstance):
>>           cppinstance = self.space.interp_w(W_CPPInstance, w_cppinstance, can_be_None=True)
>>           if cppinstance:
>
> are you sure that you really want to kill this promote? I suspect that it 
> makes accessing to C++ fields much slower, because it has to recalculate the 
> offset every time.

yes, it would make it a lot slower, since it adds a C++ call. However, the
translation failed and if it does succeed (as was the case for functions, so
I still need to figure out what the real difference is), then it doesn't do
anything at runtime. I have it more on my "look into this later" list.

What I did for now, is that I took one short-cut out of the C-API, which is
the most common case: if the handle to which the data member belongs and the
handle of "this" are the same, the offset is by definition zero. I put that
in python, so fully visible to the JIT, and only call the back-end if some
calculation is needed. Then I get the expected speeds again (for the most
common case).

This is the kind of thing that I'll want to use the jitviewer for, once I'm
beyond functionality and only need to care about performance. :)

Best regards,
            Wim
-- 
WLavrijsen at lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net


More information about the pypy-dev mailing list