Thread overview
Updated compiler-benchmark
Jul 16
jmh530
Jul 16
jmh530
Jul 16
IGotD-
July 16
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

## Conclusions (from sample run shown below)

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.
July 16
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.
July 16
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.
July 16
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
July 16
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
July 16
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.
July 16
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!
July 16
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.
July 17
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.