[pypy-dev] testing floating point

Fredrik Johansson fredrik.johansson at gmail.com
Thu Feb 3 00:29:30 CET 2011


On Thu, Feb 3, 2011 at 12:10 AM, Amaury Forgeot d'Arc
<amauryfa at gmail.com> wrote:
> 2011/2/3 Fredrik Johansson <fredrik.johansson at gmail.com>:
>> Indeed (that user was me, and it was nice to see the problem fixed so
>> quickly!). There is one incompatibility left between CPython and PyPy
>> that breaks some functions in mpmath. In CPython, round() and
>> functions in the math module accept (and convert) inputs of any custom
>> type with a __float__ method, whereas they trigger a TypeError in PyPy
>> (1.4).
>
> It seems corrected today; the script below indeed fails with pypy-1.4.

Ah, that's nice. Does round() work as well?

>> On win32, PyPy 1.4 is about 40% slower than CPython 2.6 for running
>> the entire set of tests. This is probably mostly due to the slowness
>> of longs in PyPy. However, much of the regular floating point code
>> seems to be slower in PyPy as well.
>
> The standard operations, or the math module?
> It seems that every function in the math module releases the GIL.
> This may explain some slowness.

I have only looked at some quick macro level timings. Generally a lot
of overhead for function calls and type checking is involved (although
I would hope that PyPy can kill precisely some of that eventually).

Fredrik



More information about the Pypy-dev mailing list