Is there any language that native-compiles faster than D?

Steven Schveighoffer schveiguy at gmail.com
Wed Aug 26 14:45:48 UTC 2020


On 8/25/20 9:13 PM, James Lu wrote:
> On Thursday, 20 August 2020 at 20:50:25 UTC, Per Nordlöw wrote:
>> After having evaluated the compilation speed of D compared to other 
>> languages at
>>
>>     https://github.com/nordlow/compiler-benchmark
>>
>> I wonder; is there any language that compiles to native code anywhere 
>> nearly as fast or faster than D, except C?
>>
>> If so it most likely needs to use a backend other than LLVM.
>>
>> I believe Jai is supposed to do that but it hasn't been released yet.
> 
> V8 JavaScript compiles faster:
> 
> $ d8 --always-opt --trace-opt --single-threaded --no-compilation-cache 
> mandelbrot.js | ts -s "%.s"
> 0.000025 [compiling method 0x3fc50821068d <JSFunction (sfi = 
> 0x3fc508210165)> using TurboFan]
> 0.001651 [optimizing 0x3fc50821068d <JSFunction (sfi = 0x3fc508210165)> 
> - took 4.455, 41.945, 0.052 ms]
> 0.001707 [optimizing 0x3fc508085b65 <JSFunction Complex (sfi = 
> 0x3fc508210261)> because --always-opt]
> 0.001736 [compiling method 0x3fc508085b65 <JSFunction Complex (sfi = 
> 0x3fc508210261)> using TurboFan]
> 0.001763 [optimizing 0x3fc508085b65 <JSFunction Complex (sfi = 
> 0x3fc508210261)> - took 0.125, 0.284, 0.019 ms]
> 0.001789 [optimizing 0x3fc508211665 <JSFunction iterate_mandelbrot (sfi 
> = 0x3fc508210229)> because --always-opt]
> 0.001817 [compiling method 0x3fc508211665 <JSFunction iterate_mandelbrot 
> (sfi = 0x3fc508210229)> using TurboFan]
> 0.001842 [optimizing 0x3fc508211665 <JSFunction iterate_mandelbrot (sfi 
> = 0x3fc508210229)> - took 0.167, 1.197, 0.022 ms]
> 0.001868 [optimizing 0x3fc508085b85 <JSFunction abs (sfi = 
> 0x3fc508210299)> because --always-opt]
> 0.001892 [compiling method 0x3fc508085b85 <JSFunction abs (sfi = 
> 0x3fc508210299)> using TurboFan]
> 0.001916 [optimizing 0x3fc508085b85 <JSFunction abs (sfi = 
> 0x3fc508210299)> - took 0.125, 0.421, 0.025 ms]
> 0.002093 [optimizing 0x3fc508085bbd <JSFunction mul (sfi = 
> 0x3fc508210309)> because --always-opt]
> 0.002337 [compiling method 0x3fc508085bbd <JSFunction mul (sfi = 
> 0x3fc508210309)> using TurboFan]
> 0.002365 [optimizing 0x3fc508085bbd <JSFunction mul (sfi = 
> 0x3fc508210309)> - took 0.134, 0.550, 0.023 ms]
> 0.002389 [optimizing 0x3fc508085ba1 <JSFunction add (sfi = 
> 0x3fc5082102d1)> because --always-opt]
> 0.002498 [compiling method 0x3fc508085ba1 <JSFunction add (sfi = 
> 0x3fc5082102d1)> using TurboFan]

I just want to point out that ts is not an accurate timestamping system. 
The shell is starting ts and d8 simultaneously, and it's very possible 
that d8 has done a lot of stuff by the time ts gets around to deciding 
what timestamp 0 is. In fact, d8 could be completely finished, and all 
its output buffered in the pipe, before ts does anything. Especially 
when these times are so short.

Not saying the data is wrong, but I am not certain this is proof.

Use shell time builtin.

-Steve


More information about the Digitalmars-d mailing list