On Tuesday, 17 January 2023 at 23:27:03 UTC, matheus wrote:
I ran in two sites: https://onecompiler.com/d and then
https://godbolt.org/, with the latter I set LDC with -O2.
My version (Source in the end) ran about 2x faster than the
version with ranges.
Well, the use of ranges is not the only difference.
Can you try to run the following diagnostics program on this D
Online Compiler platform?
https://gist.github.com/ssvb/5c926ed9bc755900fdaac3b71a0f7cfd
https://onecompiler.com/d/3yv7t9ap9
Gives me:
HelloWorld.d(43): Error: undefined identifier `volatileStore`
HelloWorld.d(44): Error: undefined identifier `volatileLoad`
The volatileStore/volatileLoad functions used to be in
`core.bitop` in the old versions of D compilers, but then moved
to `core.volatile`. This kind of reshuffling is annoying, because
supporting multiple versions of D compilers becomes unnecessarily
difficult. After importing `core.volatile` in
https://onecompiler.com/d/3yv7u9v7c now it prints:
Detected compiler: DMD
Performance warning: '-O' option was not used!
Performance warning: '-release' option was not used!
Performance warning: DMD generates much slower code than GDC
or LDC!
And this is a systematic problem with various online D compilers.
Some of them don't bother to enable optimizations. Which isn't
bad by itself, but makes it unsuitable for running benchmarks.