Thread overview
Lua JIT 2.0b
Nov 03, 2009
bearophile
Nov 03, 2009
Justin Johansson
Nov 04, 2009
bearophile
Nov 04, 2009
Justin Johansson
November 03, 2009
Lua is a dynamically-typed language, so its insights are not directly applicable to D, but recently the version 2.0beta of its Just-in-time compiler has become available:
http://www.reddit.com/r/programming/comments/9zrnp/luajit_2_beta_released/

Today this JIT is probably the most advanced for dynamic languages. Even V8, that's a very efficient JIT for JavaScript (and that's 2-5 times faster than the new JIT of Firefox), partially developed by expert people coming from the optimization of Smalltalk VM, produces very slow programs compared to this last Lua JIT:
http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=luajit&lang2=v8&box=1

Its SpecMark2 performance may even be compard to DMD ones :o) (I have translated specmark2 to D, if you want it):
http://pastebin.ca/1650985
My timings of SpecMark2, for comparison:
Timings on WinXp 32 bit, 2.00 seconds min time:
               small   large
  D DMD:         299    207
  D DMD:         401    268 (OOP version)
  C GCC:         578    314
  C LLVM-GCC:    609    351

But the meat of this post can be found here: http://article.gmane.org/gmane.comp.lang.lua.general/58908

It's the first time I see tagged floating point doubles, as far as I know not even good CommonLisp implementations are smart enough to use them!
The ideas behing Lua associative arrays can be used to speed up the common enough case of small AAs in D language. That JIT is created by a single programmer, and I think he's really intelligent and good. He's a top programmer, among the best ten I know :-)

Bye,
bearophile
November 03, 2009
bearophile Wrote:

> Lua is a dynamically-typed language, so its insights are not directly applicable to D, but recently the version 2.0beta of its Just-in-time compiler has become available:
> http://www.reddit.com/r/programming/comments/9zrnp/luajit_2_beta_released/
> 
> Today this JIT is probably the most advanced for dynamic languages. Even V8, that's a very efficient JIT for JavaScript (and that's 2-5 times faster than the new JIT of Firefox), partially developed by expert people coming from the optimization of Smalltalk VM, produces very slow programs compared to this last Lua JIT:
> http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=luajit&lang2=v8&box=1
> 
> Its SpecMark2 performance may even be compard to DMD ones :o) (I have translated specmark2 to D, if you want it):
> http://pastebin.ca/1650985
> My timings of SpecMark2, for comparison:
> Timings on WinXp 32 bit, 2.00 seconds min time:
>                small   large
>   D DMD:         299    207
>   D DMD:         401    268 (OOP version)
>   C GCC:         578    314
>   C LLVM-GCC:    609    351
> 
> But the meat of this post can be found here: http://article.gmane.org/gmane.comp.lang.lua.general/58908
> 
> It's the first time I see tagged floating point doubles, as far as I know not even good CommonLisp implementations are smart enough to use them!
> The ideas behing Lua associative arrays can be used to speed up the common enough case of small AAs in D language. That JIT is created by a single programmer, and I think he's really intelligent and good. He's a top programmer, among the best ten I know :-)
> 
> Bye,
> bearophile

Wow!  Confirms that cleverness/intelligence runs on a logarithmic scale.
Can we hire this guy for D?
Thanks for posting this bearophile.

ciao
justin

November 04, 2009
Justin Johansson:

> Can we hire this guy for D?

To create the best JIT of the world you need skills that are probably quite different from the skills needed to design a new language constrained to be kinda backwards compatible with C and that's in the range of complexity of C++. I think you need a person able to design things in a very orthogonal way, to not add more special cases in D2 and remove some of the ones already present. I think a person like Guy L. Steele Jr. may be fitter :-)

Bye,
bearophile
November 04, 2009
bearophile Wrote:

> Justin Johansson:
> 
> > Can we hire this guy for D?
> 
> To create the best JIT of the world you need skills that are probably quite different from the skills needed to design a new language constrained to be kinda backwards compatible with C and that's in the range of complexity of C++. I think you need a person able to design things in a very orthogonal way, to not add more special cases in D2 and remove some of the ones already present. I think a person like Guy L. Steele Jr. may be fitter :-)
> 
> Bye,
> bearophile

Of course.  It wasn't a serious question (plus who's got money to hire anyway); and, btw, certainly not in way meant to be disrespectful of the many talented people among the core D developers, committers/volunteers and wider D community.

ciao,
justin