dmd -run speed trends

Siarhei Siamashka siarhei.siamashka at gmail.com
Sat Dec 16 00:38:37 UTC 2023


Appears that linking Phobos as a static or a shared library makes 
a gigantic difference for this test. The shared library variant 
is much faster to compile. Changing `dmd.conf` in the unpacked 
tarball of the binary DMD compiler release to append 
`-L-rpath=%@P%/../lib64 -defaultlib=phobos2` makes `dmd -run` 
almost twice faster for me.

```
[Environment32]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import 
-L-L%@P%/../lib32 -L--export-dynamic -fPIC -L-rpath=%@P%/../lib32 
-defaultlib=phobos2

[Environment64]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import 
-L-L%@P%/../lib64 -L--export-dynamic -fPIC -L-rpath=%@P%/../lib64 
-defaultlib=phobos2
```

And it's interesting that using the `mold` linker (via adding the 
`-Xcc=-fuse-ld=mold` option) appears to fail only when linking 
static 64-bit Phobos. Linking static 32-bit Phobos works, both 
shared 64-bit and 32-bit Phobos appear to work too.

Creating binaries that depend on the shared Phobos library isn't 
a reasonable default configuration. However it seems to be 
perfectly fine if used specifically for the "-run" option. Would 
adding an extra section in the `dmd.conf` file for the "-run" 
configuration be justified?

Oh, and I already mentioned `rdmd` before. Burn this thing with 
fire!


More information about the Digitalmars-d mailing list