Why is D Slow?

Sergey kornburn at yandex.ru
Wed Jul 26 08:20:29 UTC 2023


On Wednesday, 26 July 2023 at 07:44:35 UTC, Dlang Lover wrote:
> I've been reviewing most Benchmark tests lately. However, 
> system programming languages ​​such as Rust and C++ promise 
> high speed in almost every field. But I can't see that for D 
> language. For example, does it make sense for a Web Framework 
> to have such a speed issue between Rust and D? Why is there 
> such a speed difference?
>
> https://web-frameworks-benchmark.netlify.app/compare?f=vibed,axum
>
> Again, when I examine a few tests outside of the Web domain, 
> for example, in the Github repository below, D language comes 
> after C++ and Rust most of the time, but here too, DMD is slow 
> next to LDC and GDC.
>
> https://github.com/kostya/benchmarks
>
> What's behind the speed problem of the D language? What can be 
> done for this? Although I do not know much about compiler and 
> language development, if there is a solution to such problems? 
> I want to support as much as I can.

So these are different points.
Web is separate, the test in this particular repo is quite dumb 
(still shows some info). For example, Django also has low numbers 
there, still one of the most popular solution. I’m preparing some 
analysis on web frameworks. Will post it soon.

Regarding the other link. You can’t just look at the numbers 
overall. Need to check exact solutions.
Algorithms could be different. Some solutions could just make 
more profiling work and SIMD/parallel/cache tweaks, while another 
are fine with simple code implementation (especially if some 
external library is used).

Secondly, in most cases used std implementations, which could be 
not most performant, but flexible to be used in different ways. 
So std implementations in other langs could be more performant, 
but has not so pleasant APIs to use. And the speed of development 
also another major feature, that usually is not covered in 
benchmarks.

Third, hard to speak about whole language. In my opinion it is 
better to be more precise, and find particular parts of std, that 
could be potentially improved.

Based on my experience in other benchmark game these are BigInt, 
AA(honestly all containers need a rework, after stability work 
will be finished and change-freeze will be discontinued), 
parallel map implementations.


More information about the Digitalmars-d mailing list