dmd -run speed trends

Witold Baryluk witold.baryluk at gmail.com
Sun Dec 17 17:37:34 UTC 2023


On Sunday, 17 December 2023 at 12:52:56 UTC, Siarhei Siamashka 
wrote:
> On Saturday, 16 December 2023 at 23:35:12 UTC, Siarhei 
> Siamashka wrote:
>> That's what any normal user would see if they compare 
>> compilers out of the box in the most straightforward manner 
>> without tweaking anything.
>
> Now if we start tweaking things, then it makes sense to use 
> `dub` or `dmd -run` instead of `rdmd`, because `rdmd` just 
> wastes precious milliseconds for nothing. Then there's shared 
> vs. static Phobos and the possibility to use a faster linker 
> (mold). Here's another comparison table (with a "printf" 
> variant from 
> https://forum.dlang.org/post/pfmgiokvucafwbuldjaj@forum.dlang.org added too), all timings are for running the program immediately after editing its source:
>
> | test                      | static | shared | static+mold | 
> shared+mold |
> |---------------------------|--------|--------|-------------|-------------|
> | rdmd bench_writefln.d     | 1.21s  | 0.98s  |    1.02s    |   
>  0.93s    |
> | dub bench_writefln.d      | 0.84s  | 0.60s  |    0.63s    |   
>  0.55s    |
> | dmd -run bench_writefln.d | 0.80s  | 0.55s  |    0.60s    |   
>  0.51s    |
> |---------------------------|--------|--------|-------------|-------------|
> | rdmd bench_writeln.d      | 0.60s  | 0.38s  |    0.43s    |   
>  0.34s    |
> | dub bench_writeln.d       | 0.50s  | 0.27s  |    0.32s    |   
>  0.23s    |
> | dmd -run bench_writeln.d  | 0.47s  | 0.23s  |    0.28s    |   
>  0.19s    |
> |---------------------------|--------|--------|-------------|-------------|
> | rdmd bench_printf.d       | 0.33s  | 0.13s  |    0.18s    |   
>  0.09s    |
> | dub bench_printf.d        | 0.34s  | 0.14s  |    0.19s    |   
>  0.10s    |
> | dmd -run bench_printf.d   | 0.31s  | 0.10s  |    0.15s    |   
>  0.06s    |
>


Thank you for your tests. Quite interesting.

I do recommend running each tests few (way more than few), and 
taking minimums. Tool called `hyperfine` (packaged in many Linux 
distros actually), is a good option (do not take average, take 
minimum). If you do not other precautions (like idle system, 
controlling cpu boost frequency, and setting performance 
governor), numbers could be close to meaningless.



More information about the Digitalmars-d mailing list