Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gcc pgo flag : worth it ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
krumpf
Apprentice
Apprentice


Joined: 15 Jul 2018
Posts: 192

PostPosted: Fri Jun 23, 2023 3:59 pm    Post subject: gcc pgo flag : worth it ? Reply with quote

Hi.
From equery u gcc
Quote:
GCC will build itself and then analyze the just-built binary and then rebuild itself using the data obtained from analysis of codepaths taken.
It does not affect whether GCC itself supports PGO when building other software. This substantially increases the build time needed for building GCC itself.

So I'm wondering, does it actually decrease compilation times for other programs ? Does it just affect the final size of generated binaries ?
Users who enabled pgo for gcc, what's your experience with it ? It is worth it ?
Back to top
View user's profile Send private message
Thistled
Guru
Guru


Joined: 06 Jan 2011
Posts: 572
Location: Scotland

PostPosted: Sun Jul 02, 2023 12:30 am    Post subject: Reply with quote

Why not give it a try and see for yourself?
That's the beauty of Gentoo. You learn so much in the process of experimentation.
_________________
Whatever you do, do it properly!
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6070
Location: Removed by Neddy

PostPosted: Fri Jul 07, 2023 2:29 pm    Post subject: Reply with quote

please bear in mind that this increases compile time alot and GCC is bumped quite frequently in ~arch and while PGO could yield 5-7% improvements, there is a chance this improvement in GCC usage is totally lost due to the frequency of revision bumps
_________________
#define HelloWorld int
#define Int main()
#define Return printf
#define Print return
#include <stdio>
HelloWorld Int {
Return("Hello, world!\n");
Print 0;
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2204

PostPosted: Fri Jul 07, 2023 5:50 pm    Post subject: Re: gcc pgo flag : worth it ? Reply with quote

krumpf wrote:
Hi.
From equery u gcc
Quote:
GCC will build itself and then analyze the just-built binary and then rebuild itself using the data obtained from analysis of codepaths taken
. ...

I find pgo enthusiasm a bit misguided sometimes. Using pgo as above should optimize gcc compiling gcc - not necessarily anything else...
I'm sure I read the "recommended" use of pgo with python was to gather statistics for python compiling its test suite, which of course optimises it for, er, compiling the test suite, rather than anything real.

If you are going to use pgo to improve gcc performance, you probably should collect statistics for all use of gcc over a number of portage updates, and if you use gcc for your own code, that too, and only then feed the results to pgo. But, of course, that's (a) a lot of hassle, and (b) going to give a prolonged period of bad performance while you collect those stats. What pgo gives with one hand, it takes with the other.
_________________
Greybeard
Back to top
View user's profile Send private message
krumpf
Apprentice
Apprentice


Joined: 15 Jul 2018
Posts: 192

PostPosted: Sat Jul 08, 2023 6:48 pm    Post subject: Re: gcc pgo flag : worth it ? Reply with quote

Goverp wrote:
If you are going to use pgo to improve gcc performance, you probably should collect statistics for all use of gcc over a number of portage updates, and if you use gcc for your own code, that too, and only then feed the results to pgo. But, of course, that's (a) a lot of hassle, and (b) going to give a prolonged period of bad performance while you collect those stats. What pgo gives with one hand, it takes with the other.

So I guess the answer to my question is : nope, not worth it for an ordinary user.

Thanks folks for the feedback.


Last edited by krumpf on Sat Jul 08, 2023 8:33 pm; edited 1 time in total
Back to top
View user's profile Send private message
Goverp
Advocate
Advocate


Joined: 07 Mar 2007
Posts: 2204

PostPosted: Sat Jul 08, 2023 7:16 pm    Post subject: Reply with quote

The one place I'd expect worthwhile gains from pgo is if you were spending a lot of time running Qemu to simulate say a Raspberry Pi - then it would be worth collecting stats for a typical job stream on the emulated Pi. That's assuming Qemu is written in a language the compiler for which supports pgo - not something I know about.
_________________
Greybeard
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum