dmd -run speed trends
Siarhei Siamashka
siarhei.siamashka at gmail.com
Tue Dec 19 01:57:38 UTC 2023
On Sunday, 17 December 2023 at 17:34:01 UTC, Witold Baryluk wrote:
> On Sunday, 17 December 2023 at 08:17:18 UTC, Siarhei Siamashka
> wrote:
>> Running `touch` was not enough to prevent Nim from reusing the
>> cached version. Appending a single space character to the
>> source code on each test iteration resolved this problem.
>
> This is not how I run my tests of Nim. I cleaned all Nim cache
> instead.
And what have you achieved by clearing Nim's cache? Nim still
spends a bit of time to check whether the cached binary exists.
And then spends a bit of time to save the newly created binary in
its cache for future use. That's an extra overhead and the
comparison against `dmd -run` won't be fair no matter what you
do. But the functionality of `nim r` and `go run` can be directly
compared to `rdmd` and `dub`, because all of them implement
various forms of caching.
>> 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?
>
> What?! I always (for a decade) tough that dmd by default links
> dynamically phobos. I think it should definitively link
> dynamically by default. Just like gcc, gdc, ldc, clang are
> doing things. Compiling phobos statically by default does not
> really solve versioning fully anyway, as one still have
> dependencies on glibc, and such.
Dynamic linking with glibc isn't too bad. Old programs still keep
working fine after upgrading glibc to newer versions. The same
can't be said about phobos.
But I'm talking about `dmd -run`. The compiled binary is
discarded after use. So there are no downsides of using dynamic
linking in this scenario. We can get a nice compilation speed
improvement for free. The use of static linking just makes `dmd
-run` slower and this is a waste.
More information about the Digitalmars-d
mailing list