Ryan Davis wrote:
I'm doing a proof of concept to see if nekovm would be a good target for a ruby
backend (I didn't see anything over the last year in the ML archives to that
effect). I'm getting wildly different times based on how I go about
hand-translating. I'd love some hints/tips to try to see if this POC will pan
out or not.
The goal is for a pure-OO language like ruby to translate down to neko and be
at least as performant as MRI ruby (which is admittedly rather slow, esp in
method dispatch). Ruby, like neko, has immediates for small integers, but
they're pure OO, so I was boxing them in neko so I could simulate actual method
calls (tho I wasn't using call/apply yet). The performance was surprising to me
(from 5x faster to ~18x slower than ruby), and I'm guessing it is mainly due to
the amount of allocations I was doing. No real profiling data tho (how?).
<snip>
A profiler is on my wish-list. You can use neko -stats, but it doesn't
tell you about Neko function calls.
Without commenting on the code, I don't personally see this as a viable
thing to do. Ruby's object model and scoping rules do not fit the NekoVM
very well, so you will have to build a lot of that yourself instead of
being able to take advantage of built-in functionality. In my
experience, the NekoVM seem to only be fast when you do things the way
it expects. Of course, this may be my own fault, I don't know :)
-Justin
--
Neko : One VM to run them all
(http://nekovm.org)