Does the compiler inline the predicate functions to std.algorithm.sort?

Stefan Koch uplink.coder at googlemail.com
Sun Mar 18 14:15:37 UTC 2018


On Sunday, 18 March 2018 at 12:59:06 UTC, tipdbmp wrote:
> I can't read assembly but it seems to me that it doesn't: 
> https://godbolt.org/g/PCsnPT
> I think C++'s sort can take a "function object" that can get 
> inlined.

Correct it does not get in-lined.
Even with -O3 it does not.

The reason is that the code the sort instantiation produces is 
too big for the inliner cost function.

If you have a look at the the cg file produced when you specify 
-vcg-ast you can see that it's a massive amount of code.


More information about the Digitalmars-d-learn mailing list