Jai compiles 80,000 lines of code in under a second

Neia Neutuladh neia at ikeran.org
Fri Sep 21 00:04:02 UTC 2018


On Thursday, 20 September 2018 at 23:13:38 UTC, aliak wrote:
> Alo!
>
> I just watched this talk from Jonathan Blow [0] about his 
> programming language called Jai, and he can now compile an 
> 80,000 line game in about 1.5 seconds on a laptop (of course I 
> have no idea what laptop he's using), under 1 second on a 
> desktop.

Jai is in the hands of maybe a dozen people and , so it's hard to 
compare. But with a sufficiently simple language with no 
metaprogramming, 80k lines of code in 1.5 seconds seems doable.

And in that situation, dmd does just fine -- 0.73 seconds to 
compile 84k lines of simple generated code on i5 2400, or 0.20 
seconds with -c -o-.

It's just that D code tends toward heavy metaprogramming. That's 
a lot safer (consider C-style varargs writefln versus the 
template version), and it's slower to compile.

> On a related note: He also mentions some really cool 
> compilation features like having compiler hooks that tell you 
> when compilation is done, when executable and where it will be 
> written so you can create your build recipe inside the program 
> itself. Also allows you do do things like:
>
> whenCompilationFinishes(exeLocation) => 
> loadExecutableIcon(myIcon, exeLocation)
>
> During the build!
>
> Your source knows how to build itself as a concept is awesome! 
> There's actually a D runner [1] that kind of allows for source 
> files to set stuff up.

It's awesome for demos and terrible otherwise. It takes "it 
builds on my machine" to a new level.


More information about the Digitalmars-d mailing list