Force inline

berni via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Feb 21 02:08:03 PST 2017


On Monday, 20 February 2017 at 13:48:30 UTC, ketmar wrote:
> anyway, in my real-life code inlining never worth the MASSIVELY 
> increased compile times: speedup is never actually noticeable. 
> if "dmd -O" doesn't satisfy your needs, there is usually no 
> reason to trying "-inline", it is better to switch to ldc/gdc.

Probably you're right. I'm using gdc anyway for non-developement 
compiles. I was just curious how much that -inline switch of dmd 
is worth. (Answer: Yet, almost nothing. And knowing, that it is 
buggy together with -O even less than that.)

When comparing dmd and gdc the results where both almost the 
same: 29 seconds. (As a reference: C++ is 22 seconds.) With gdc I 
got a good improvement when using -frelease additionally to -O3 
(now it's 24 seconds). The inline-pragma didn't change anything.

On Monday, 20 February 2017 at 17:12:59 UTC, H. S. Teoh wrote:

> Having said all that, though, have you used a profiler to 
> determine whether or not your performance bottleneck is really 
> at the function in question?

Yes, I did. An well, yes I know: Good design is much more 
important, than speed optimization. And by obeying this, I found 
out, that by changing the order of the conditions used in that 
particular function, I could reduce the duration by 2 more 
seconds... (And in case you wonder, why I bother about 2 seconds: 
It's a small example for testing purpose. There are larger ones 
where this could easily be hours instead of seconds...)


More information about the Digitalmars-d-learn mailing list