dmd -run speed trends
Siarhei Siamashka
siarhei.siamashka at gmail.com
Sun Dec 17 09:14:31 UTC 2023
On Sunday, 17 December 2023 at 06:40:33 UTC, Witold Baryluk wrote:
> On Saturday, 16 December 2023 at 03:31:05 UTC, Walter Bright
> wrote:
>> It would be illuminating to compare using printf rather than
>> writefln.
>
> Ok, added `extern(C) int printf(const char *format, ...);`, and
> measured various variants.
I don't think that there's much practical value in testing
`printf` because it's not compatible with `@safe` and can't be
recommended for developing normal D applications. This scenario
gets out of touch with reality and becomes way too artificial.
> * mold 2.3.3 and mold 2.4.0, segfault, when using with dmd or
> ldc2.
https://github.com/dlang/dmd/pull/15915 improves dmd's
compatibility with mold 2.4.0 or maybe even fixes all problems if
we are optimistic.
> [...]
> ```
> stat("/usr/include/dmd/druntime/import/core/internal/array/comparison.di", 0x7ffecfc2a0f0) = -1 ENOENT (No such file or directory)
> stat("/usr/include/dmd/druntime/import/core/internal/array/comparison.d", {st_mode=S_IFREG|0644, st_size=7333, ...}) = 0
> stat("/usr/include/dmd/druntime/import/core/internal/array/comparison.d", {st_mode=S_IFREG|0644, st_size=7333, ...}) = 0
> openat(AT_FDCWD,
> "/usr/include/dmd/druntime/import/core/internal/array/comparison.d", O_RDONLY) = 3
> fstat(3, {st_mode=S_IFREG|0644, st_size=7333, ...}) = 0
> read(3, "/**\n * This module contains comp"..., 7333) = 7333
> close(3)
> ```
>
> Each of these syscalls is about 15μs on my system (when
> stracing, probably little less in real run without `strace`
> overheads)
>
> There should be a way to reduce this in half with smarter
> sequencing (i.e. do `open` first instead of `stat + open +
> fstat`).
That's an interesting discovery. Now it's necessary to implement
a proof of concept patch for dmd to check how much this can
actually help in reality. Can you try this?
More information about the Digitalmars-d
mailing list