Virtual Methods hurting performance in the DMD frontend
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Sun Sep 11 14:48:56 PDT 2016
Hi,
As you may know I am currently optimizing template-related code
inside of DMD.
Inside DMD code quality is quite high, there is little low
hanging fruit.
However there is one thing that suspiciously often shows up the
on profilers display.
Those are indirect class which have a high number of L2(!)
i-cache misses.
These calls don't do a lot of work. They are needed either for
downcasts or to verify the dynamic type of an AST-Node.
Even without the i-cache related stalls the call overhead alone
is something to think about.
For template-heavy code matching template parameters is one of
the most frequently operations.
Since Template Parameters can be types expressions or symbols the
dynamic-types are heavily queried.
First experiments suggest that a speedup of around 12% is
possible if the types where accessible directly.
Since dmd uses visitors for many things now the benefit of
virtual methods is highly reduced.
Please share your thoughts.
Cheers,
Stefan
More information about the Digitalmars-d
mailing list