Already a substantial amount of work has gone into making Ruby, R, node and Python to work.
This is the Python implementation -
They have an example where this code is compiled:
total = 0
for i in range(n):
total = total + i
if n < 0:
return n*(n-1) // 2
That is, the assembly generated by clang seems to be equivalent to
if n <= 0:
return ((n-1)*(n-2) >> 1) + (n-1)
Copyright (c) Regents of the University of California and individual contributors.
On the wiki home page, we have :
Wei Zhang, Facebook, Inc.
Mohaned Qunaibit, University of California Irvine
So basically, this is half owned by FaceBook... Right ?
I'll try to just talk about what makes Python hard to run quickly (especially as compared to less-dynamic languages like JS or Lua).
The thing I wish people understood about Python performance is that the difficulties come from Python's extremely rich object model, not from anything about its dynamic scopes or dynamic types. The problem is that every
operation in Python will typically have multiple points at which the user can override the behavior, and these features are used, often very extensively. Some examples are inspecting the locals of a frame after the frame
has exited, mutating functions in-place, or even something as banal as overriding isinstance. These are all things that we had to support, and are used enough that we have to support efficiently, and don't have analogs in
less-dynamic languages like JS or Lua.
I'd love to see a comparison of the various JIT libraries. I guess both give you optimizations and register allocation for free. Of course, the JITting speed is quite important as well.
Mostly what messing around with it did was taught me that I had a lot to learn about compiler construction which is what I've been slowly doing since then.
Sadly it looks like it's stalled :(