Mauricio Skips Recursion With YARV's Hidden Levels! #
Mauricio’s found some CFLAGS in YARV which will power-up the opcodes to give Ruby a highly swift route through recursion. He runs an Ackermann on Ruby HEAD for a time of 1.815
seconds, compared with St. Valentine’s YARV which clocks in at 0.027
. (Note that he’s including a 0.02
sleep!)
I’m dying for Nintendo Power to put out a big fold-out map of YARV opcodes and cheats. Anyway, be sure to check the leftmost column of ko1’s map before telling Slashdot that Ruby is leaving streak marks everywhere, lest we become the new heirs to Alex Chiu. You can’t see it, but I am winking.
^_^
< A clever optimizations indeed. Just the same, my hopeful heart was searching for some sort of tail-recursion dealie. Maybe Santa will bring it.)
MenTaLguY
Yes, tail recursion is the sauce.
MenTaLguY
Hmm. Actually I think many of these opcodes could—potentially—be used in a tail position.
Probably shouldn’t be looking for tail-recursive versions of individual opcodes.
It’s possible there is something in the structure of the instruction stream itself that would allow the interpreter to identify tail calls.
MenTaLguY
Double-checking some YARV disassembly, all tail ops are followed by
end
, so there’s nothing stopping the VM from doing a one-opcode lookahead to decide on a tail call or not.aberant
what? i get a new job and am away from my ruby blogs for a week and they already get a VM? man…
jes5199
well, yeah, great, haha, etc but YARV actually was faster out-of-the-box for my code. yay. maybe i can figure out how to make it even faster.
farfignugen
Looks like Java is now officially obsolete!
vdrab
I remember ko1 collecting the “computer language shootout” ruby submissions to test Yarv. I know about the whole controversy surrounding that benchmark, but would like to see how Yarv does anyways ; ). In any case, there’s two entries for python as well, CPython and Python Psyco. Somebody notify the people over at http://shootout.alioth.debian.org/ there’s a new player in town.
isaac gouy
“Somebody notify the people over at”
That would be a feature request, but there’s too much alpha and beta stuff – so we’d wait for proper release. http://shootout.alioth.debian.org/faq.php#report
Incidentally, we combined the naive recursive algorithms, see http://shootout.alioth.debian.org/gp4/benchmark.php?test=recursive&lang=all
Shame no one’s contributed a Ruby implementation.
mardoen
I finally found a decent YARV test case among my scripts (parsing 3.300 small XML files with REXML ) and documented it here— not as impressive as the test results at eigenclass, but still faster than interpreted Ruby.
Comments are closed for this entry.