On Wednesday, 19 August 2015 at 08:29:05 UTC, Walter Bright wrote:
On 8/19/2015 1:11 AM, Dmitry Olshansky wrote:
When looking at AST there is no way to correctly estimate cost
function - code
generated may be huge with user-defined types/operators.
Sure the cost function is fuzzy, but it tends to work well
enough.
No, looking at what DMD geenrate, it is obviously not good at
inlining. Here is the issue, when you have A calling B calling C,
once you have inlined C into B, and ran optimization, you often
find that there are dramatic simplifications you can do (this
tends to be especially true with templates) and that may make B
eligible for inlining into A, because it became simpler instead
of more complex.
Optimize top-down, inline bottom-up and reoptimize as you inline.
That's proven tech.