On Thu, Feb 3, 2011 at 8:01 AM, Maciej Fijalkowski <[email protected]> wrote:
> On Thu, Feb 3, 2011 at 1:43 AM, Fredrik Johansson
> <[email protected]> wrote:
>> On Thu, Feb 3, 2011 at 12:32 AM, Alex Gaynor <[email protected]> wrote:
>>> If you have any benchmarks where we are slower that don't involve longs
>>> that'd be great, since for float operations we really should be able to beat
>>> up on CPython.
>>
>> A simple example: mpmath.fp.fsum(mpmath.fp.sqrt(k) for k in xrange(1000000))
>
> A brief follow up.
>
> * PyPy trunk is faster (by quite a bit).
>
> * I noticed that you happily use mixture of old and new style classes.
> As of now this is a really bad case for PyPy. Example:
>
>>>>> [isinstance(i, type) for i in mpmath.fp.__class__.__mro__]
> [True, True, True, True, False, False, True, True, False, True, True,
> True, True, True, True]
>
> when I replace it with newstyle classes it runs much faster

Interesting. The mixture of old and new style classes is a mistake, of
course. I'm going to add a test to make sure this doesn't happen.
Thanks for pointing it out.

In fact this speeds up another benchmark I did -- [fp.lambertw(k) for
k in xrange(50000)]-- by 10x, which is quite a ridiculous ratio!

> Other things that speed up both CPython and PyPy:
>
> * Put this things into function instead of at global scope

Do you mean in the benchmark or did you have some other code you saw in mind?

> * Use list comprehension instead of generator expression.

I hope PyPy can do more in the future to speed up generator expressions.

Fredrik
_______________________________________________
[email protected]
http://codespeak.net/mailman/listinfo/pypy-dev

Reply via email to