By: Jukka Larja (roskakori2006.delete@this.gmail.com), June 6, 2022 8:42 pm
Room: Moderated Discussions
Peter Lewis (peter.delete@this.notyahoo.com) on June 6, 2022 3:55 am wrote:
> > There's PGO of course, but that really only works for interpreted or jitted languages.
>
> The Intel C/C++ Compiler has Profile-Guided Optimization (PGO).
> Have you had some bad experience with PGO for compiled languages?
Base problems are that 1) it's extra trouble[1], 2) where to get representative data to run PGO with, and 3) benefits are small.
When interpreting or jitting, compiler can constantly reoptimize based on performance counters. In theory. I have no idea if it's truly practical or if anyone is doing that. From programmer point of view PGO is either free or just a matter of specifying a flag somewhere.
Generally speaking, any suggestion that starts with "change your compiler" (or in this case, "buy a new compiler") is already having rather big issues with 1). That said, every major compiler has PGO support, so if it was a big boost, it could be worth it. However, there are examples of PGO making code perform worse, usually due to training data set being too different. We would need to do rather large amount of work just to make sure we are actually getting a benefit on large number of relevant cases.
[1] Extra trouble is OK, if benefits are comparable. Based on quick googling, even in simple tests (no variable data) PGO offers usually less than 10 % improvement, which is pretty bad for anything that actually requires someone to maintain.
-JLarja
> > There's PGO of course, but that really only works for interpreted or jitted languages.
>
> The Intel C/C++ Compiler has Profile-Guided Optimization (PGO).
> Have you had some bad experience with PGO for compiled languages?
Base problems are that 1) it's extra trouble[1], 2) where to get representative data to run PGO with, and 3) benefits are small.
When interpreting or jitting, compiler can constantly reoptimize based on performance counters. In theory. I have no idea if it's truly practical or if anyone is doing that. From programmer point of view PGO is either free or just a matter of specifying a flag somewhere.
Generally speaking, any suggestion that starts with "change your compiler" (or in this case, "buy a new compiler") is already having rather big issues with 1). That said, every major compiler has PGO support, so if it was a big boost, it could be worth it. However, there are examples of PGO making code perform worse, usually due to training data set being too different. We would need to do rather large amount of work just to make sure we are actually getting a benefit on large number of relevant cases.
[1] Extra trouble is OK, if benefits are comparable. Based on quick googling, even in simple tests (no variable data) PGO offers usually less than 10 % improvement, which is pretty bad for anything that actually requires someone to maintain.
-JLarja