Optimisation possibilities: current, future and enhancements
Marco Leise via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 29 06:13:34 PDT 2016
Am Thu, 25 Aug 2016 11:45:40 +0000
schrieb Cauterite <cauterite at gmail.com>:
> - if a function is pure and called with constexpr parameters, the
> compiler could potentially execute that call in the CTFE engine
> (automatically), as part of the constant-folding phase I guess.
> Such a technique will hopefully one day be practical, once the
> CTFE engine's performance improves.
Just a note on where compiler technology stands right now:
Const-folding after inlining will have this effect for small
pure functions. I've also seen GCC duplicate functions to
remove one of the arguments with a constant if it figured it
could optimize the function around that argument. This is
effectively the same as having a 2nd version of the function
that takes the run-time argument as a compile-time argument.
--
Marco
More information about the Digitalmars-d
mailing list