Announcing Pyston: an upcoming, JIT-based Python implementation
tech.dropbox.com
tech.dropbox.com
This is a weird way of putting it. Method-at-a-time JITs have been around much longer and represent a more traditional approach to JIT compilers. Tracing JITs have only become popular in the last 5-10 years. And during that time they've been seen as the sort of hot new thing, so much that there is a classic LtU thread from 2010 titled "Have tracing JIT compilers won?" (http://lambda-the-ultimate.org/node/3851)
While it's true that V8 has always been method-at-a-time and Mozilla has abandoned their tracing JIT TraceMonkey, LuaJIT is one of the fastest dynamic language implementations out there and is a tracing JIT. Unfortunately the benchmark game dropped LuaJIT so it's not easy to find benchmarks, but last I saw LuaJIT was pretty dominant speed-wise among dynamic language JIT implementations.
Mike Pall (LuaJIT author) argues that TraceMonkey's lack of compelling performance was more a result of trying to bolt tracing onto an existing VM as opposed to any shortcoming of tracing as an approach (http://lambda-the-ultimate.org/node/3851#comment-57643).
If only someone else was interested enough to make some comparison measurements.
Meanwhile -- http://luajit.org/performance_x86.html
I mean, if your end goal is to write another Python, sure go for it. But it really sounds like these people haven't done their research. I see nothing to write home about.
--- EDIT ---
Not to mention that JS is a completely different language form Python. Everytime you add two objects in Python you have the possibility of hitting a system defined add, or __add__ or __getattr__ or __getattribute__, or __radd__, or __getattr__ (looking for __radd__), etc. That'll be fun....
They approach they're describing is one that already works in V8, JScore, and IonMonkey, which is to mix type prediction, type analysis, and runtime handling of unexpected cases. Basically, you use type feedback information to get an initial set of types for a method, use type inference techniques to squeeze out type checks, and then compile the method in a way that handles the expected types in a fast path and traps into a slow path as necessary.
Allocation removal by partial evaluation in a tracing JIT: http://dl.acm.org/citation.cfm?id=1929508
Allocation Sinking Optimization: http://wiki.luajit.org/Allocation-Sinking-Optimization
This is not correct. V8 does sink allocations into deoptimization exits. It does not sink allocations out of the loops at the moment though.
> I think it is unknown how to do this well in method JITs
I don't think it is unknown. The main simplification for tracing JITs comes from the fact that deoptimization and loop-exit can be elegantly treated within the uniform framework, which is a little bit harder for method JIT and you need to find right place to insert materialization instruction after the loop based on post-domination. Nothing hard or unsolvable though.
You're definitely right, Python has a lot of user-customizability that can make it harder to execute efficiently than JavaScript (though thankfully it has less than Ruby). Both PyPy and Pyston have their techniques for cutting through the complicated+expensive slow case and trying to predict and execute a fast path.
That's pretty much a solved problem. Lookup the method once, cache it for next time, deoptimize if you're wrong or the definition of the class changes. If it keeps changing build up a larger cache.
Ruby has exactly the same behaviour, and we can still get it down to really simple machine code http://www.chrisseaton.com/rubytruffle/how-method-dispatch-w....
http://qinsb.blogspot.kr/2011/03/unladen-swallow-retrospecti...
1 - http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-October/0665...
Even LLVM's "fast" code generator is slower than most JITs' code generators.
I think you can look at the people who are interested in adding LLVM tiers to their JITs (ex Apple, Facebook) to see that we're not the only ones that think there can be a place for "good but expensive" code generation in a JIT.
"(...). As for Unladen Swallow, there are some reasons to think that LLVM has matured greatly in the past few years, particularly in the JIT engine which has been completely replaced. I'm not sure if that's the only part to the story; I'd be interested in talking with any of the people who were involved or knowledgeable about the project."
I'd bet the Dropbox team is aware of unladen swallow and the issues it faced.
Applied too broadly, that quote would mean "never try anything where others have failed."
Guido worked at Google during Unladen Swallow, he was not involved. From the comments of Pyston's announcements, here's the extent of GvR's involvement:
> Guido's advice has been extremely helpful, but so far we haven't been able to get any code from him :/
Right now they have no baseline compiler but will interpret (un-optimised?) LLVM IR at first, second tier is unoptimised LLVM compilation, then LLVM compilation with type recording hooks and finally a fully optimised compile. Given the history of the Unladed Swallow project and others using the LLVM JIT, they're likely to find they have a lot of work on their hands, particularly as PyPy is really rather good these days.
EDIT: There's some more info here in a post to the LLVM mailing list by one of the Pyston developers http://article.gmane.org/gmane.comp.compilers.llvm.devel/718.... They've added a simple escape analysis pass for GCed memory among other things.
As always, if you're interested in LLVM or compiler stuff you should subscribe to http://llvmweekly.org (disclaimer: I write it) and follow @llvmweekly
Please. Python 3 is ready. :(
Mercurial is an example, I think twisted is another.
What does Python 3 offers in terms of : performance, or improved libraries, safety, other major improvements to justify spending time switching production code to it, breaking library dependencies (could be transitive as well).
I don't see a company with a large Python code base justifying switching to Python 3. Yeah personal toy Github projects, sure, Python 3 is nice, but it is simply not enough rewards justifying all the downsides of switching for many projects.
Looking back, how Python 3 was handled was a mistake. There should not have been a Python 3 when it happened. It should have happened a lot earlier. But if it was going to happen, it should have offered some drastic benefits -- GIL is gone, LLVM JIT 30x numerical code crunching improvements, integration with PyPy, ... I don't know, awesome new built-in libraries like "requests", Flask integrated in. Things like that.
What do we have instead?, unicode improvements, generator code improvements, a Twisted-like async library (don't get me started on that). Iterator cleanups around dicts... That is just not enough, sorry.
When will a new language be developed that also provides the Smalltalk developer experience out of the box?
I also toy with the idea of build a language, and my main contender is luajit (perhaps with terra). In the other hand, julia have be done on the LLVM...