Hello.
First a disclaimer. This post is more about plans for future than current status. We usually try to write about things that we have done, because it's much much easier to promise things than to actually make it happen, but I think it's important enough to have some sort of roadmap.
In recent months we came to the point where the 5th generation of JIT prototype was working as nice or even a bit nicer than 1st one back in 2007. Someone might ask "so why did you spend all this time without going forward?". And indeed, we spend a lot of time moving sideways, but as posted, we also spent a lot of time doing some other things, which are important as well. The main advantage of current JIT incarnation is much much simpler than the first one. Even I can comprehend it, which is much of an improvement :-)
So, the prototype is working and gives very nice speedups in range of 20-30x over CPython. We're pretty confident this prototype will work and will produce fast python interpreter eventually. So we decided that now we'll work towards changing prototype into something stable and solid. This might sound easy, but in fact it's not. Having stable assembler backend and optimizations that keep semantics is not as easy as it might sound.
The current roadmap, as I see it, looks like as following:
- Provide a JIT that does not speedup things, but produce assembler without optimizations turned on, that is correct and able to run CPython's library tests on a nightly basis.
- Introduce simple optimizations, that should make above JIT a bit faster than CPython. With optimizations disabled JIT is producing incredibly dumb assembler, which is slower than correspoding C code, even with removal of interpretation overhead (which is not very surprising).
- Backport optimizations from JIT prototype, one by one, keeping an eye on how they perform and making sure they don't break anything.
- Create new optimizations, like speeding up attribute access.
- Profit.
This way, we can hopefully provide a working JIT, which gives fast python interpreter, which is a bit harder than just a nice prototype.
Tell us what you think about this plan.
Cheers,fijal & others.
I think it's a great idea. If the test suite succeeds on the basic JIT, it's much easier to spot regressions when you start adding the cool stuff. It also gives you a solid foundation to build on.
ReplyDeleteGood luck, this project is amazing :)
Its not obvious from this post what would actually be the difference between the prototype and the final jit with all the prototypes optimisations. So ... it sounds like a lot of work for zero gain. I'm sure there is missing information, like what is actually missing from or wrong with the prototype ( is it in a different language? Prolog?) Without this information its impossible to judge this plan.
ReplyDeleteThis sounds like a very pragmatic approach and is very encouraging. Nice work guys - very much looking forward to what the future has to offer.
ReplyDeleteI'm extremely excited about seeing this happen. It is an unfortunate fact that the majority of people won't get PyPy until they see a 'big win'. Once they've noticed the big win they will start to see the 'hidden genius'. I'm glad that you are taking such a professional approach to this next phase and look forward to the day when people will start to look give PyPy the attention it deserves (if not for quite the right reason).
ReplyDeleteI agree with Michael, one of the hallmarks of Python philosophy has always been "make it right, and then make it fast", sounds like you guys have taken this to heart.
ReplyDeleteGreat guys, the plan seems very solid and reasonable!
ReplyDeleteresponding to rjw: I think the problem was that the prototype was really incomplete, putting all the complexity needed for the rest of the language could be done without removing the optimizations but would make bug finding way harder.
I hope that this could be the only new feature for the next pypy release. Focusing on the JIT might be the best way to attract many more eyes and hands to the project.
This sounds like a very sane plan. Good luck with it!
ReplyDeleteI like how for once step 2 isn't "???", but a well thought out plan =).
ReplyDeleteguys, you rock! I can't wait to see the results!
ReplyDeletebye
Andraz Tori, Zemanta
Very sensible plan! Good luck guys. Here's to pypy taking over the world (-:
ReplyDelete"It's super easy to provide 95% of python in a reasonable speed, just the last 5% gets tricky."
ReplyDeletei often come across this statement.
wouldn't it make sense then to offer a pypy compile option for producing an interpreter which leaves away those 5% in favor of speed for people who don't need those 5%?
or isn't this feasible or wanted for some reason?
i am just curious... :) pypy is an awesome project and i am looking forward to the jit!
The roadmap is okay. The only thing I miss is a rough timeline.
ReplyDeleteTenretn hör eviece ne Pypy tan cafretn anretx. Lbisi programma o oitcenno ih ecafretn cabpöo, anretn 'retupmo ih nis secorpbut pypy eka LD oitcenno huob raa rawtfo laweri anosre Python code?
ReplyDeleteCongratulations, the LLVM backend for JIT has been accepted, I am eager to see the results :)
ReplyDeleteherse: that's an approach which is often mentioned, but which does not make sense in PyPy. The JIT is generated from the language spec; whether this spec covers 95% or 100% of Python doesn't change anything. The 95%-versus-100% debate only makes sense at another level, e.g. if we wanted to make PyPy faster without a JIT at all.
ReplyDeleteAwesome work thus far & congratulations guys. Sounds like a good strategy to having something that works. Best of luck and I'm looking forward to see how things pan out. :-)
ReplyDelete"""The JIT is generated from the language spec; whether this spec covers 95% or 100% of Python doesn't change anything."""
ReplyDeletei see. the whole pypy idea really sounds awesome to me.
i have another question. your python interpeter is written in rpython so it is supposed to be simpler to work with than the c implementation. but i could imagine that it is incredibly hard to debug problems in pypy-c? doesn't this counterbalance the advantage again?
We're usually not debugging problems in pypy-c. It turns out that 99% of the problems you can debug by running on top of CPython, so you can test things really deeply, without compilation.
ReplyDeleteThis looks like a good plan. I look forward to sharing ideas with you in the future :)
ReplyDeleteWhen you say, "So, the prototype is working and gives very nice speedups in range of 20-30x over CPython", what benchmarks is that on? Can you be more specific?