11 ms·
PyPy 2.0 Released
- gtaylor 14y agoThe gevent/eventlet part of this has me pretty excited. We needed this in order to do some experimenting with PyPy without investing a good deal of time on a test conversion. I'm also interested to see if cffi is as good as I've heard it is (relative to ctypes). Excellent work, fijal and team!
- rdtsc 14y agoThis is exciting for eventlet. Coupled with recent resurgence of work on it, it might bring it back into spotlight.
- MichailP 14y agoCan someone knowledgeable compare PyPy, Numba and Cython? I mostly use Cython. Tried Numba also, it has very nice workflow when it works with autojit (when it doesn't error messages are pretty cryptic). With PyPy I don't understand why for example all that type information obtained from jit wouldn't be used to make something like Numba specialized functions or Cython modules (noob question but please answer).
- DasIch 14y agoCython is a compiler not an interpreter. Numba requires explicit hinting and can only optimize some undefined (?) subset of Python. PyPy on the other hand is simply a fast Python interpreter. Not sure what you mean regarding the type information gathered by the JIT.
- MichailP 14y agoFor example does PyPy always warm up, or can it store "warmed up" version of some function (where type of objects is inferred)? I know that this is not in accordance with highly dynamic nature of Python, but not all functions are highly dynamic.
- cglace 14y agoDo you mean can you save the state of the JIT for future use?
- rubinelli 14y agoYeah. Can you? Considering CPython already generates .pyc and checks timestamps, keeping some kind of JIT cache around wouldn't be a stretch.
- rcthompson 14y agoMy understanding (from a previous HN discussion about javascript) is that since the output from a "just-in-time compiler" is actually machine code generated on the fly, it includes direct references to memory locations that are only valid for the lifetime of the process. So the output of a JIT is simply not in a format that can be saved and reloaded later.
- nickik 14y agoActually its possible to have a JIT like that but it is uncommon.
- andreasvc 14y agoCython is not actually a compiler. It is essentially a more convenient way of writing C/C++ extension modules. It produces C/C++ glue code which is then compiled by an actual compiler like gcc. By tapping into the existing C API of cpython it is simpler than PyPy & NumPy which work on a lower level, but on the other hand Cython does little optimization for you.
- Thrymr 14y agoPyPy still doesn't work with Numpy, though they're working on it.
- MostAwesomeDude 14y agoNumba is not Numpy.
- apendleton 14y agoThat's not quite right. Stock numpy doesn't install, and nobody's working on that as far as I know, but they've reimplemented part of the numpy API (at least the Python API, not the C one), and the subset they've implemented works fine. I have an application in production that uses it.
- robert-zaremba 14y agoPyPy has it's own implementation of Numpy (called numpypy). It's not 100% complete but quiet functional. http://morepypy.blogspot.com/search?q=numpypy http://morepypy.blogspot.com/search?q=numpypy
- Derbasti 14y agoHave you tried the cffi? I used to use cython, but since I found the cffi, I haven't looked back.
- MichailP 14y agoNo, I got scared away by Simple example and Real example from the docs :) Do you maybe have some hints/links for cffi?
- robert-zaremba 14y agoThere are a lot of cffi c bindings. I used with success: * https://github.com/amauryfa/lxml/tree/lxml-cffi https://github.com/amauryfa/lxml/tree/lxml-cffi * https://github.com/chtd/psycopg2cffi https://github.com/chtd/psycopg2cffi
- pjmlp 14y agoCongratulations! Looking forward to the day PyPy becomes the reference implementation.
- Osmium 14y agoI'm with you on that one. But bear in mind it doesn't support Python 3 yet, so it might still be some way away.
- craigyk 14y agoGod yes. I wish the CPython people would just capitulate and throw themselves behind it.
- darkarmani 14y agoBecause who cares of existing, running, legacy code, right?
- cpeterso 14y agoDo you mean the people who haven't upgraded from Python 2.7 to Python 3?
- buster 14y agoThe people who haven't upgraded to Python 3 in their projects are probably mostly people with dependencies on py2.7 libraries. Happened to me in my last project. I started using pypy until some bug in pypy prevented me from using an important package. Switched to python 3 until some other dependency wasn't available. So it's a pity, but i was more or less forced to use py2.7 (without putting major effort into 3rd party libraries).
- melling 14y agoDoes anyone have any performance comparisons to Perl? I've used Perl for over a decade. Just started using Python on a project. I've got a lot to learn but Python makes you feel like you've got it down pretty quickly. One of the things that kept me on Perl was its great performance. http://benchmarksgame.alioth.debian.org/u64q/perl.php http://benchmarksgame.alioth.debian.org/u64q/perl.php I'd like to go for the win, win. Is that 'FTWW?'
- wiremine 14y agoI haven't seen Perl vs. PyPy stats, but here is some CPython vs. PyPy benchmarks: http://speed.pypy.org/ http://speed.pypy.org/
- moonlight80 14y agoHere are posts that compares CPython 2.7, 3.3 and PyPy 1.9: 1. web frameworks performance: http://mindref.blogspot.com/2012/09/python-fastest-web-framework.html http://mindref.blogspot.com/2012/09/python-fastest-web-frame... 2. template engine performance: http://mindref.blogspot.com/2012/07/python-fastest-template.html http://mindref.blogspot.com/2012/07/python-fastest-template.... It would be interesting to see how PyPy 1.9 compares to 2.0 in those benchmarks.
- jholman 14y agoInteresting datum you used. That chart shows that, on those compilers, on those programs, with those test data, Perl and CPython are VERY similar in speed. If you compare your link (Perl / CPython) with the inverse (CPython / Perl), you almost can't tell the graphs apart. http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=all&lang=python3&lang2=perl&data=u64q http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?t... So CPython is about the same speed as Perl. PyPy's speed comparison suggests that PyPy is 2-20x faster than CPython. What else do you want to know? Perl, btw, is not noted for its "great performance" in any context I've ever heard of.
- melling 14y agoPerl is famous for it regex performance. For many years people have compared Python, Ruby, and Perl performance and it has usually been Perl as the fastest followed by Python then Ruby. I've seen many posts like this: http://stackoverflow.com/questions/12793562/text-processing-python-vs-perl-performance http://stackoverflow.com/questions/12793562/text-processing-... These days, however, it appears that Python has really come into its own. I started using Sublime Text so that got me into trying out Python.
- amix 14y agoIf you like this remember to donate some money to the project on http://pypy.org/ http://pypy.org/ [I am not in any way affiliated with PyPy, only supporting the project].
- philfreo 14y agoWhat are the largest sites using PyPy in production?
- riffraff 14y agoquora did at some point but it seems they replaced it (or some usage of it) with scala, I can't find any pointer at the moment but google could help you.
- xyproto 14y agopypy is cool, but why no love for python 3?
- ak217 14y agohttp://pypy.org/py3donate.html http://pypy.org/py3donate.html http://morepypy.blogspot.com/2013/03/py3k-status-update-10.html http://morepypy.blogspot.com/2013/03/py3k-status-update-10.h...
- adamt 14y agoWhilst I applaud the efforts of PyPy, I've always been disappointed with the performance benefit it's given me with real world code. Specifically: * PyPy Dict performance is very slow (slower than Cpython). A lot of the code I need to write that is cpu-intensive python code processes data (from stuff like logs) into various data structures that use dicts. Pypy is rarely more than 10% faster and sometimes slower. * The memory management/GC can be bad. I've seen the same code that runs fine on cpython end up using excessive amounts of memory (and causing out of memory issues etc) with PyPy. Again - this is normally involving complicated data-structures. On about 10 occasions now I've had CPU bound Python tasks, then I've tried to use with PyPy and never had > 20% performance improvements. Which is a big contrast with the benchmarks. Is it just me? Or have other people had similar experiences? [edit: typos]
- illumen 14y agoThe benchmarks are a little bit misleading for some types of code. They do not measure single run code well. In these cases pypy doesn't do as well as when the JIT has warmed up. The interpreter is slower than the CPython one. For code which doesn't JIT well, it will go slower with pypy. The firefox JS engine now has a fast interpreter, a quick JIT, and a more optimizing one. This means the baseline performance is better in CPython, so if pypy manages to make their interpreter better baseline performance will get better. The memory management in CPython is much more predictable and deterministic since it is using reference counting and not GC. The pypy GC may be faster in many circumstances however. IO in pypy can be slower sometimes if the GC is unhappy with the way you're doing it. Especially if you're leaving files open, or reading in different sized chunks of data. The new pypy release speeds up a few different types of real world code however. XML processing, DB processing, and stackless async code (eventlet, and greenlet) are three areas where pypy has improved with this release. Numpy based code is another area where pypy has gotten better with this release. In short, pypy still has many areas where it could improve... but with each release is getting better at more types of real code :) For run-once, and latency or memory sensitive code the benchmarks may be a bit misleading.
- kenko 14y ago
- snaky 14y agoIs it still slower than LuaJIT?
- jmelloy 14y agoI get about 2x speedup on my CSV reader & processing app, which is nice. When I tried the beta, it was crashy, but 2.0 seems pretty good so far.