dmd -run speed trends

Siarhei Siamashka siarhei.siamashka at gmail.com
Mon Dec 18 17:28:50 UTC 2023


On Sunday, 17 December 2023 at 17:37:34 UTC, Witold Baryluk wrote:

> If you do not other precautions (like idle system, controlling 
> cpu boost frequency, and setting performance governor), numbers 
> could be close to meaningless.

The numbers are fairly accurate with ~0.01s precision, which is 
good enough to see the differences. I have a constant CPU clock 
frequency in my computer without turbo boost or cpufreq. And 
here's possibly the final table, which additionally measures the 
impact of taking advantage of PGO (the PGO build instructions are 
at 
https://forum.dlang.org/post/vbrxpsqqtfelfpcbclpk@forum.dlang.org):

| test                      | static | shared | shared+pgo | 
shared+pgo+mold |
|---------------------------|--------|--------|------------|-----------------|
| rdmd bench_writefln.d     | 1.21s  | 0.98s  |   0.84s    |     
0.78s       |
| dub bench_writefln.d      | 0.84s  | 0.60s  |   0.53s    |     
0.47s       |
| dmd -run bench_writefln.d | 0.80s  | 0.55s  |   0.49s    |     
0.43s       |
|---------------------------|--------|--------|------------|-----------------|
| rdmd bench_writeln.d      | 0.60s  | 0.38s  |   0.35s    |     
0.30s       |
| dub bench_writeln.d       | 0.50s  | 0.27s  |   0.25s    |     
0.21s       |
| dmd -run bench_writeln.d  | 0.47s  | 0.23s  |   0.21s    |     
0.17s       |
|---------------------------|--------|--------|------------|-----------------|
| rdmd bench_printf.d       | 0.33s  | 0.13s  |   0.13s    |     
0.08s       |
| dub bench_printf.d        | 0.34s  | 0.14s  |   0.14s    |     
0.09s       |
| dmd -run bench_printf.d   | 0.31s  | 0.10s  |   0.10s    |     
0.06s       |

PGO can be potentially tuned by training it on a different set of 
input data (for example, the Phobos code instead of the DMD 
testsuite). As an extra experiment, I also tried to replace LDC 
with GDC for compiling DMD, but the resulting compiler was slow. 
Changing -O2 to -O3 didn't help. And trying to enable LTO when 
compiling the DMD compiler crashed GDC.


More information about the Digitalmars-d mailing list