Thread overview
Poor Performance gdc11 for base 64 with O3
Sep 19
Mahdi
Sep 20
Mahdi
September 19

In optimization level 3, gdc11 doesn't seem to work as well as gdc10 for base 64 benchmark.
On this site:
https://github.com/kostya/benchmarks#base64

, the poor performance of GDC 11 is well visible, but while version 10 did a good optimization.

I did a base 64 experiment on RISCV64 architecture (other than Intel) with ubuntu-image:

In gdc-11(RISCV64):

 ubuntu@ubuntu:~/dlang/benchmark/benchmarks/base64/gdc-11$ gdc-11 -O3 test.d
 ubuntu@ubuntu:~/dlang/benchmark/benchmarks/base64/gdc-11$ time ./a.out
 encode aaaa... to YWFh...: 1431666688, 20.53
 decode YWFh... to aaaa...: 1073741824, 50.37

 real	1m11.219s
 user	1m10.793s
 sys	0m0.171s
______________________________________________________________________________
In gdc-10(RISCv64):
 ubuntu@ubuntu:~/dlang/benchmark/benchmarks/base64/gdc-10$ gdc-10 -O3 test.d
 ubuntu@ubuntu:~/dlang/benchmark/benchmarks/base64/gdc-10$ time ./a.out
 encode aaaa... to YWFh...: 1431666688, 18.48
 decode YWFh... to aaaa...: 1073741824, 14.55

 real	0m33.447s
 user	0m33.108s
 sys	0m0.220s

source code from :
https://github.com/kostya/benchmarks/blob/master/base64/test.d

September 19

On Sunday, 19 September 2021 at 19:04:28 UTC, Mahdi wrote:

>

In optimization level 3, gdc11 doesn't seem to work as well as gdc10 for base 64 benchmark.
On this site:
https://github.com/kostya/benchmarks#base64

[...]

It's because of libphobos not being compiled with inlining due to the changes to template linkage emission. If you rebuild Phobos with LTO enabled (if it isn't already) you can get your performance back.

Compile with LTO and try that.

September 20

On Sunday, 19 September 2021 at 19:31:27 UTC, max haughton wrote:

>

On Sunday, 19 September 2021 at 19:04:28 UTC, Mahdi wrote:

>

In optimization level 3, gdc11 doesn't seem to work as well as gdc10 for base 64 benchmark.
On this site:
https://github.com/kostya/benchmarks#base64

[...]

It's because of libphobos not being compiled with inlining due to the changes to template linkage emission. If you rebuild Phobos with LTO enabled (if it isn't already) you can get your performance back.

Compile with LTO and try that.

Thanks
I experimented with lto but it got worse:

ubuntu@ubuntu:~/dlang/benchmark/benchmarks/base64/gdc-11$ gdc-11 -flto -O3 test.d
ubuntu@ubuntu:~/dlang/benchmark/benchmarks/base64/gdc-11$ time ./a.out
encode aaaa... to YWFh...: 1431666688, 20.83
decode YWFh... to aaaa...: 1073741824, 69.34

real 1m30.447s
user 1m29.369s
sys 0m0.191s