www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Blog post: PGO: Optimizing D's virtual calls

reply Johan Engelen <j j.nl> writes:
Hi all,
   I've written an article about how I implemented profile-guided 
optimization (PGO) of virtual calls to direct calls (a 
micro-micro-optimization, expected performance gain of just a few 
percent if any!). I hope it's interesting for those of you who 
like to read about compiler internals.

https://johanengelen.github.io/ldc/2016/04/13/PGO-in-LDC-virtual-calls.html

It's my first programming article, please be gentle with your 
comments :-)

cheers,
   Johan
Apr 13 2016
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 04/13/2016 07:34 AM, Johan Engelen wrote:
 Hi all,
    I've written an article about how I implemented profile-guided
 optimization (PGO) of virtual calls to direct calls (a
 micro-micro-optimization, expected performance gain of just a few
 percent if any!). I hope it's interesting for those of you who like to
 read about compiler internals.

 https://johanengelen.github.io/ldc/2016/04/13/PGO-in-LDC-virtual-calls.html

 It's my first programming article, please be gentle with your comments :-)

 cheers,
    Johan
Noice. https://twitter.com/D_Programming/status/720236648034877440 https://www.facebook.com/dlang.org/posts/1275322695814742 https://www.reddit.com/r/programming/comments/4elfok/profile_guided_optimization_optimizing_ds_virtual/ http://hackerne.ws Andrei
Apr 13 2016
parent reply Johan Engelen <j j.nl> writes:
On Wednesday, 13 April 2016 at 13:08:30 UTC, Andrei Alexandrescu 
wrote:
 Noice.

 https://twitter.com/D_Programming/status/720236648034877440

 https://www.facebook.com/dlang.org/posts/1275322695814742

 https://www.reddit.com/r/programming/comments/4elfok/profile_guided_optimization_optimizing_ds_virtual/

 http://hackerne.ws
Thanks for posting these! -Johan
Apr 14 2016
parent Kai Nacke <kai redstar.de> writes:
On Thursday, 14 April 2016 at 08:20:53 UTC, Johan Engelen wrote:
 On Wednesday, 13 April 2016 at 13:08:30 UTC, Andrei 
 Alexandrescu wrote:
 Noice.

 https://twitter.com/D_Programming/status/720236648034877440

 https://www.facebook.com/dlang.org/posts/1275322695814742

 https://www.reddit.com/r/programming/comments/4elfok/profile_guided_optimization_optimizing_ds_virtual/

 http://hackerne.ws
Thanks for posting these! -Johan
Found this, too: http://llvmweekly.org/issue/120
Apr 18 2016
prev sibling next sibling parent reply Johan Engelen <j j.nl> writes:
On Wednesday, 13 April 2016 at 11:34:26 UTC, Johan Engelen wrote:
 Hi all,
   I've written an article about how I implemented 
 profile-guided optimization (PGO) of virtual calls to direct 
 calls (a micro-micro-optimization, expected performance gain of 
 just a few percent if any!).
I've updated the article with performance measurements of just the D code of LDC: the improvement with PGO is about 7% !
Apr 15 2016
parent reply Marco Leise <Marco.Leise gmx.de> writes:
Am Fri, 15 Apr 2016 09:04:21 +0000
schrieb Johan Engelen <j j.nl>:

 On Wednesday, 13 April 2016 at 11:34:26 UTC, Johan Engelen wrote:
 Hi all,
   I've written an article about how I implemented 
 profile-guided optimization (PGO) of virtual calls to direct 
 calls (a micro-micro-optimization, expected performance gain of 
 just a few percent if any!).  
I've updated the article with performance measurements of just the D code of LDC: the improvement with PGO is about 7% !
Compilers are full of logic that makes some code 0.5% faster. The sum of all these little bits is what makes up an optimizing compiler and if today you still find an optimization that's worth 1 or 2% you have a jackpot! 7% is quite a bit more than any other option like -cpu=native could achieve. If feasible I'd enjoy if ldc2 shipped with a pgo configuration option. If you use the compiler in a lot of edit/compile cycles it will pay off. -- Marco
Apr 20 2016
parent Johan Engelen <j j.nl> writes:
On Wednesday, 20 April 2016 at 22:10:53 UTC, Marco Leise wrote:
 
 7% is quite a bit more than any other option like -cpu=native 
 could achieve. If feasible I'd enjoy if ldc2 shipped with a pgo 
 configuration option. If you use the compiler in a lot of 
 edit/compile cycles it will pay off.
This was the use-case I was optimizing for, and so I will add an option to pass a PGO profile to the CMake script :-) Note that it is a 7% improvement in the D part of LDC. The optimizer (LLVM, C++) takes most of the time during compilation and so the overall performance increase is smaller.
Apr 21 2016
prev sibling parent Johan Engelen <j j.nl> writes:
On Wednesday, 13 April 2016 at 11:34:26 UTC, Johan Engelen wrote:
 Hi all,
   I've written an article about how I implemented 
 profile-guided optimization (PGO)
I packaged LDC v1.0.0 with PGO for OS X: https://github.com/JohanEngelen/ldc/releases/tag/v1.0.0-beta1-pgo All your feedback is very welcome :-) cheers, Johan
Apr 29 2016