Slow performance compared to C++, ideas?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Fri May 31 05:55:29 PDT 2013


On 05/31/2013 01:48 PM, Manu wrote:
> I find that using templates actually makes it more likely for the compiler to
> properly inline. But I think the totally generic expressions produce cases where
> the compiler is considering too many possibilities that inhibit many optimisations.
> It might also be that the optimisations get a lot more complex when the code
> fragments span across a complex call tree with optimisation dependencies on
> non-deterministic inlining.

Thanks for the detailed advice. :-)

There are two particular things I noted about my own code.  One is that whereas
in the original the template variables were very simple (just a floating-point
type) in the new version they are more complex structures that are indeed more
generic (the idea was to enable the code to handle both mutable and immutable
forms of one particular data structure).

The second is that the templatization gets moved from the mixin to the functions
themselves.  I guess that the mixin has the effect of copy-pasting _as if_ I was
just writing precisely what I intended.


More information about the Digitalmars-d mailing list