lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Chris wrote:
> I can't remember if I asked this before but at some point will LuaJIT
> be able to improve its recursive call speed?  In this area LuaJIT
> seems to lag way behind VM's like Google's V8.  It's pretty easy to
> see the difference when using benchmarks like Ackermann or Fibonacci
> where LuaJIT is about 4 times slower in my tests.

Yes, recursion is not compiled (yet). This is mentioned in the
status page.

[Note: tail-recursive calls *are* supported. They're fast, too.]

Up-recursion is not too difficult. Some support code for counting
hotcalls is already there. Down-recursion is much more difficult,
but I already have some ideas for that.

Still, recursion is, umm, 'unpopular' in Lua (outside of synthetic
benchmarks). Other things have a higher priority on my list.

[That, BTW, is what annoys me most about V8: their benchmarketing.
They ported some quaint, recursive SmallTalk benchmarks to
JavaScript, tuned their VM for it and now claim bragging rights.
That roughly 0% of all JavaScript on the web makes use of
recursion doesn't seem to bother them at all.]

[Umm, before the functional programmers come to slaughter me: yes,
recursion is a useful tool. But compiler optimization is not a
beauty contest. Popularity of language idioms is what matters most.]