Optimisation possibilities: current, future and enhancements

Cecil Ward via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 25 05:27:20 PDT 2016


On Thursday, 25 August 2016 at 11:55:08 UTC, Cauterite wrote:
> On Thursday, 25 August 2016 at 11:16:52 UTC, Cecil Ward wrote:
>> * the GCC "__builtin_expect()"
>
> Instead of adding individual micro-optimisation features like 
> this, I'd be more interested in the potential for 
> profile-guided optimisation (which *ideally* can make these 
> micro-optimisation decisions automatically). Since DMD already 
> has some framework in place to support code profiling, I 
> suspect this is at least a feasible enhancement.
>
> On the other hand, it might not be worth trying to play 
> catch-up with existing PGO features in GCC/LLVM. If you're 
> using PGO, you're probably already using these other backends 
> for their more advanced static optimisers.

One killer reason for me to use D rather than C or C++ would be 
if it either has or could be enhanced to have greater code 
optimisation possibilities. LTO isn't relevant here because it's 
equally applicable to other languages (in GCC at any rate, as I 
understand it). Aside from its own properties, D might have an 
advantage over C because its spec development could possibly be 
more agile, well, compared with C _standards_ anyway. GCC has 
kept innovating with non-standard features, to its credit. I 
think it's desirable for D not to fall _behind_ GCC's 
non-standard powerful and ingenious tricks.


More information about the Digitalmars-d mailing list