www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why is D Slow?

reply Dlang Lover <dlang lover.com> writes:
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.
Jul 26 2023
next sibling parent Sergey <kornburn yandex.ru> writes:
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.
Jul 26 2023
prev sibling next sibling parent Sergey <kornburn yandex.ru> writes:
On Wednesday, 26 July 2023 at 07:44:35 UTC, Dlang Lover wrote:

And without deep analysis, this kind of Topic name is quite wrong 
and harmful.
Jul 26 2023
prev sibling next sibling parent Iain Buclaw <ibuclaw gdcproject.org> writes:
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
Shouldn't the question instead be: Why is the Web framework slow?
 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.
Without looking at what the tests are (or their validity to be called benchmarks). At least for C/gcc, C++/g++, D/gdc, and other frontend languages of GCC there is no strict reason why all couldn't be in joint position. Though each might look subtly different WRT abstractions, it is possible to get them all to generate the same AST which optimizes down to the same assembly. Saying that, there's not a lot more that can be said about [insert random benchmark] that hasn't already been hashed and rehashed time and again here.
Jul 26 2023
prev sibling next sibling parent max haughton <maxhaton gmail.com> writes:
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?

 [...]
By the looks of it none of the D dub files that I looked had been tweaked for performance whereas the competing of rust ones had been.
Jul 26 2023
prev sibling next sibling parent Guillaume Piolat <first.name gmail.com> writes:
On Wednesday, 26 July 2023 at 07:44:35 UTC, Dlang Lover wrote:
 https://github.com/kostya/benchmarks

 What's behind the speed problem of the D language?
Not wanting to disparage the results but why a benchmark would prove the existence of a "speed problem"? This is a non-sequitur. Rather it points to performance differences in the libraries, such as simdjson vs mir-ion. For instance D performs better on "matrix multiplication" benchmark, but even then benchmark doesn't compare number crunching but also does GC allocation, network...
Jul 26 2023
prev sibling next sibling parent bachmeier <no spam.net> writes:
On Wednesday, 26 July 2023 at 07:44:35 UTC, Dlang Lover wrote:

 https://github.com/kostya/benchmarks

 What's behind the speed problem of the D language? What can be 
 done for this?
Did you look at the performance of C in those same benchmarks? Why is C slow?
Jul 26 2023
prev sibling parent reply ryuukk_ <ryuukk.dev gmail.com> writes:
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.
D is not slow, programmers write slow, the community need to step up benchmark you linked proves it rust: 1.545 D: 1.657 Same, as fast as rust
Jul 26 2023
parent ryuukk_ <ryuukk.dev gmail.com> writes:
Example:

https://github.com/tchaloupka/httpbench

in this bench, http server in D is faster than both C, GO and 
Rust, see D is not slow ;)

vibe.d is just bad OOP java style code, that's the problem
Jul 26 2023