stride in slices

Johan Engelen j at j.nl
Wed Jun 6 21:03:49 UTC 2018


On Monday, 4 June 2018 at 18:47:02 UTC, Dennis wrote:
> On Monday, 4 June 2018 at 18:11:47 UTC, Steven Schveighoffer 
> wrote:
>> BTW, do you have cross-module inlining on? I wonder if that 
>> makes a difference if you didn't have it on before. (I'm 
>> somewhat speaking from ignorance, as I've heard people talk 
>> about this limitation, but am not sure exactly when it's 
>> enabled)

Cross-module inlining is never implicitly enabled in LDC. Not 
having it enabled is definitely something that hurts performance 
of LDC generated code.
Enable it with: `-enable-cross-module-inlining`. (May lead to 
missing symbols during linking when using templates with __FILE__ 
arguments.)

> I don't know much about this either. Clang has link-time 
> optimization with -O4, but looking at the --help of LDC it 
> turns out -O4 is equivalent to -O3 for D. Maybe someone else 
> knows?

Clang and LDC treat `-O4` as `-O3`.
To enable LTO (cross-module inlining and other big perf gains), 
you have to use `-flto=full`or `-flto=thin`, but it'll only give 
cross module inlining for modules that have been compiled with 
it. Notably: default Phobos/druntime is _not_ compiled with LTO 
enabled. LDC 1.9.0 release packages on Github ship with a second 
set of LTO Phobos/druntime libs. With LDC 1.9.0, you can do 
`-flto=<thin|full> -defaultlib=phobos2-ldc-lto,druntime-ldc-lto`, 
for maximum druntime/Phobos inlining.

-Johan



More information about the Digitalmars-d mailing list