7 ms·
For my (and I imagine many among us) use case, this is the takeaway: PyPy2 can now import and run many C-extension packages, among the most notable are Numpy,
by leblancfg 10y ago
For my (and I imagine many among us) use case, this is the takeaway:
PyPy2 can now import and run many C-extension packages, among the most notable are Numpy, Cython, and Pandas. Performance may be slower than CPython, especially for frequently-called short C functions. Please let us know if your use case is slow, we have ideas how to make things faster but need real-world examples (not micro-benchmarks) of problematic code.
- wfunction 10y agoIf it's useful at all, PyPy 5.7.0 was noticeably slower than CPython 2.7.11 x64 when I was using SymPy. Haven't tried out the new release though.
- sanxiyn 10y agoDid you try x64 version of PyPy? x86 version is necessarily much slower (both CPython and PyPy) if your program is long-heavy. SymPy is actually part of benchmark used by PyPy and PyPy should be faster if you compare x64 to x64.
- wfunction 10y agoNope, I'm on Windows.
- fijal 10y agoHi I've tried optimizing sympy and it's hard - there is a chance that it uses cython (which will slow things down on pypy) but also the gains were small (up to 2x) and only noticable if you run it for a while (at least few seconds). SymPy is a bit of an example that while python as a language is not necesarilly slow, since you can make a plan for most parts, it breeds culture of unnecessary meta-programming, tons of copies and dict lookups that makes it REALLY HARD to optimize. ORMs go in the same category
- denfromufa 10y agosubset of sympy can run with symengine for speedup
- deleted 10y ago[deleted]
- poizan42 10y agoIt would probably be better to port packages like Numpy to pure PyPy[0], but of course the CPython extensions compatibility layer is by itself important to increase the adoption of PyPy. The problem besides the jit not being able to inline external functions is that the CPython structures, and especially the refcounting used in CPython is problematic [1] [0]: Actually specifically numpy is being rewritten in PyPy as a RPython Mixed Module: http://doc.pypy.org/en/latest/extending.html#rpython-mixed-modules http://doc.pypy.org/en/latest/extending.html#rpython-mixed-m... [1]: http://doc.pypy.org/en/latest/discussion/rawrefcount.html http://doc.pypy.org/en/latest/discussion/rawrefcount.html
- yedpodtrzitko 10y agoThere's an attempt to create such NumPy fork already: https://bitbucket.org/pypy/numpy https://bitbucket.org/pypy/numpy