
Testing the Jai Compiler - convery
http://the-witness.net/news/2018/03/testing-the-jai-compiler/
======
muthdra
"The original designer said that "video games are machines that fill memory".
The majority of the time, game programmers are thinking about how to fill
memory with huge reams of data in ways that allow the data to be efficiently
accessed and processed. Hundreds of megabytes of memory must be moved from the
hard disk into main memory, and from there into the video card or the
processor cache to be processed and returned back to main memory. Because
video game players don’t like to wait, all this must be done as fast as is
allowable by laws of our universe. The primary purpose of a programming
language is to allow the specification of algorithms to manage data. Language
features like garbage collection and templated data streams and dynamic string
classes may help the programmer write code faster, but they don’t help the
programmer write faster code."

\-
[https://github.com/BSVino/JaiPrimer/](https://github.com/BSVino/JaiPrimer/)

------
andrewmcwatters
I admire the love and passion Jon has for his own work in the bananas.jai
video mentioned in the article. He truly enjoys this project, and that's a
great feeling that you can see on his face and hear in his description of the
compiler.

------
Dude2023
It compiles now? I thought it was a C++ transpiler.

~~~
Ace17
Honest question: (besides compile times) what are the advantages of directly
generating machine code, instead of generating C++ code?

Doesn't it actually _reduce_ the set of target platforms, while making the
compiler harder to debug (by making its output mostly non-human readable)?

~~~
dalailambda
One of the major reasons that would influence a language like Jai is that once
you do that, even if your generated C/++ is fairly optimal, you still have to
go through another slower compiler. Jai's compiler is fairly optimised for
speed and I think that would be an unacceptable trade off.

On the target platform side, a video game tends to have a fairly well known
set of platforms it will run on (new PC's, PS4, Xbox), so I think this is an
acceptable trade off.

And just a final note, the generated C/++ would be very unreadable anyway,
unless it was a direct transpiler, at which point you lose a lot of the
benefits of having a new language.

