www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Updated compiler-benchmark

reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
I've updated

     https://github.com/nordlow/compiler-benchmark

with

- source variants with templated function variants for languages 
having generics
- stdout-printing in Markdown (used in README.md)
- benchmarks for the languages Zig and V



D's compiler `dmd` is still far ahead of all its competition 
especially when it
comes to default build (standard compilation) performance.

The performance of both GCC and Clang gets significanly worse 
with each new
release (currently 8, 9, 10 in the table below).

The generic C++ and D versions compiles about 1.5 to 2 times 
slower whereas the
generic Rust version interestingly is processed 2-3 times faster 
than the non-generic
version.
Jul 16 2020
next sibling parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 16 July 2020 at 15:56:45 UTC, Per Nordlöw wrote:
 The generic C++ and D versions compiles about 1.5 to 2 times 
 slower
With DMD, that is.
Jul 16 2020
prev sibling next sibling parent reply jmh530 <john.michael.hall gmail.com> writes:
On Thursday, 16 July 2020 at 15:56:45 UTC, Per Nordlöw wrote:
 I've updated

     https://github.com/nordlow/compiler-benchmark

 with

 - source variants with templated function variants for 
 languages having generics
 - stdout-printing in Markdown (used in README.md)
 - benchmarks for the languages Zig and V

 [snip]
How are the functions generated? I see something about function-depth, but it might be good to have an example in the readme.
Jul 16 2020
next sibling parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 16 July 2020 at 18:27:54 UTC, jmh530 wrote:
 How are the functions generated? I see something about 
 function-depth, but it might be good to have an example in the 
 readme.
Ah, I'll add that. Thanks
Jul 16 2020
prev sibling next sibling parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 16 July 2020 at 18:27:54 UTC, jmh530 wrote:
 How are the functions generated? I see something about 
 function-depth, but it might be good to have an example in the 
 readme.
Added here https://github.com/nordlow/compiler-benchmark#sample-generated-code
Jul 16 2020
prev sibling parent reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 16 July 2020 at 18:27:54 UTC, jmh530 wrote:
 How are the functions generated? I see something about 
 function-depth, but it might be good to have an example in the 
 readme.
This is, of course, a very contrived benchmark but I had to pick something to get me started and I'll happily receive suggestions on how to improve the benchmarking-relevance of the generated code.
Jul 16 2020
parent jmh530 <john.michael.hall gmail.com> writes:
On Thursday, 16 July 2020 at 19:08:59 UTC, Per Nordlöw wrote:
 On Thursday, 16 July 2020 at 18:27:54 UTC, jmh530 wrote:
 How are the functions generated? I see something about 
 function-depth, but it might be good to have an example in the 
 readme.
This is, of course, a very contrived benchmark but I had to pick something to get me started and I'll happily receive suggestions on how to improve the benchmarking-relevance of the generated code.
Thanks!
Jul 16 2020
prev sibling parent reply IGotD- <nise nise.com> writes:
On Thursday, 16 July 2020 at 15:56:45 UTC, Per Nordlöw wrote:
 D's compiler `dmd` is still far ahead of all its competition 
 especially when it
 comes to default build (standard compilation) performance.
I don't think this comparison is fair as dmd is far behind when it comes to code generation compared to the competitors. What should be included are benchmarks done with LDC as well. Since you already have the D code, adding LDC should be pretty easy.
Jul 16 2020
parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
On Thursday, 16 July 2020 at 23:36:58 UTC, IGotD- wrote:
 On Thursday, 16 July 2020 at 15:56:45 UTC, Per Nordlöw wrote:
 D's compiler `dmd` is still far ahead of all its competition 
 especially when it
 comes to default build (standard compilation) performance.
I don't think this comparison is fair as dmd is far behind when it comes to code generation compared to the competitors. What should be included are benchmarks done with LDC as well. Since you already have the D code, adding LDC should be pretty easy.
Both dmd and ldc have superior check stage (lexical, syntactic and semantic analysis) because of a language designed in conjunction with the needs and limitations of a compiler. One key-property of such a design is that the D language is design to be a so called, single-pass language. The compiler dmd is superior because of a super-fast but less qualitative code generation giving outstanding productivity incremental development. At that stage in the development cycle fast builds is much more important that optimized machine code. The machine code generated by dmd in this stage is sufficiently fast for the needs of the developer trying to be productive in this stage. That is by design, not by accident. I suggest you ask Walter Bright if you want more details around his design. The compiler ldc is about 10x slower than dmd for the debug stage because of the larger overhead of the LLVM-backend and is often preferred when doing release builds.
Jul 17 2020