* Fw: binary size
[not found] <MW3PR18MB3675DED196E7FA7E19455E15804A9@MW3PR18MB3675.namprd18.prod.outlook.com>
@ 2022-01-04 2:12 ` Ming Cheng
2022-01-04 7:53 ` Jonathan Wakely
0 siblings, 1 reply; 8+ messages in thread
From: Ming Cheng @ 2022-01-04 2:12 UTC (permalink / raw)
To: gcc-help
________________________________
From: Ming Cheng <Ming.Cheng@flextrade.com>
Sent: Tuesday, January 4, 2022 2:10 AM
To: Ming Cheng <chengm349@hotmail.com>
Subject: binary size
Hi,
If I use
g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-rw-r--r-- 1 mcheng flexusr 4632980 Jan 4 09:54 libfilelog.a
If I use
g++ (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-rw-r--r-- 1 mcheng flexusr 7008006 Jan 4 10:08 libfilelog.a
How to reduce binary size generated by C++20 compiler?
Thanks.
Ming Cheng
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fw: binary size
2022-01-04 2:12 ` Fw: binary size Ming Cheng
@ 2022-01-04 7:53 ` Jonathan Wakely
2022-01-04 11:42 ` Ming Cheng
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2022-01-04 7:53 UTC (permalink / raw)
To: Ming Cheng; +Cc: gcc-help
On Tue, 4 Jan 2022, 02:13 Ming Cheng via Gcc-help, <gcc-help@gcc.gnu.org>
wrote:
>
>
> ________________________________
> From: Ming Cheng <Ming.Cheng@flextrade.com>
> Sent: Tuesday, January 4, 2022 2:10 AM
> To: Ming Cheng <chengm349@hotmail.com>
> Subject: binary size
>
>
> Hi,
>
>
>
> If I use
>
> g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
>
> Copyright (C) 2017 Free Software Foundation, Inc.
>
> This is free software; see the source for copying conditions. There is NO
>
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>
>
> -rw-r--r-- 1 mcheng flexusr 4632980 Jan 4 09:54 libfilelog.a
>
>
>
> If I use
>
> g++ (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
>
> Copyright (C) 2020 Free Software Foundation, Inc.
>
> This is free software; see the source for copying conditions. There is NO
>
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>
>
> -rw-r--r-- 1 mcheng flexusr 7008006 Jan 4 10:08 libfilelog.a
>
>
>
> How to reduce binary size generated by C++20 compiler?
>
You're just looking at the file size, and it's not a binary. The difference
is probably due to additional debug info produced by the new GCC. Other
things can affect it too, like optimization settings.
Why do you want to reduce it? What is your real goal?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fw: binary size
2022-01-04 7:53 ` Jonathan Wakely
@ 2022-01-04 11:42 ` Ming Cheng
2022-01-04 11:46 ` Ming Cheng
2022-01-04 12:12 ` Jonathan Wakely
0 siblings, 2 replies; 8+ messages in thread
From: Ming Cheng @ 2022-01-04 11:42 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: gcc-help
Hi Jonathan,
I just pasted a lib. It's applicable to binary. I am wondering whether there is a way to generate smaller binary by ver 10.2.1 close to 7.3.1? Would bigger size binary slower ?
regard
Ming
________________________________
From: Jonathan Wakely <jwakely.gcc@gmail.com>
Sent: Tuesday, January 4, 2022 7:53 AM
To: Ming Cheng <chengm349@hotmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Fw: binary size
On Tue, 4 Jan 2022, 02:13 Ming Cheng via Gcc-help, <gcc-help@gcc.gnu.org<mailto:gcc-help@gcc.gnu.org>> wrote:
________________________________
From: Ming Cheng <Ming.Cheng@flextrade.com<mailto:Ming.Cheng@flextrade.com>>
Sent: Tuesday, January 4, 2022 2:10 AM
To: Ming Cheng <chengm349@hotmail.com<mailto:chengm349@hotmail.com>>
Subject: binary size
Hi,
If I use
g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-rw-r--r-- 1 mcheng flexusr 4632980 Jan 4 09:54 libfilelog.a
If I use
g++ (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-rw-r--r-- 1 mcheng flexusr 7008006 Jan 4 10:08 libfilelog.a
How to reduce binary size generated by C++20 compiler?
You're just looking at the file size, and it's not a binary. The difference is probably due to additional debug info produced by the new GCC. Other things can affect it too, like optimization settings.
Why do you want to reduce it? What is your real goal?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fw: binary size
2022-01-04 11:42 ` Ming Cheng
@ 2022-01-04 11:46 ` Ming Cheng
2022-01-04 12:12 ` Jonathan Wakely
1 sibling, 0 replies; 8+ messages in thread
From: Ming Cheng @ 2022-01-04 11:46 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: gcc-help
Compilation flag are similar/same except some more error/warn ignore flags for c++20.
________________________________
From: Ming Cheng <chengm349@hotmail.com>
Sent: Tuesday, January 4, 2022 11:42 AM
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Fw: binary size
Hi Jonathan,
I just pasted a lib. It's applicable to binary. I am wondering whether there is a way to generate smaller binary by ver 10.2.1 close to 7.3.1? Would bigger size binary slower ?
regard
Ming
________________________________
From: Jonathan Wakely <jwakely.gcc@gmail.com>
Sent: Tuesday, January 4, 2022 7:53 AM
To: Ming Cheng <chengm349@hotmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Fw: binary size
On Tue, 4 Jan 2022, 02:13 Ming Cheng via Gcc-help, <gcc-help@gcc.gnu.org<mailto:gcc-help@gcc.gnu.org>> wrote:
________________________________
From: Ming Cheng <Ming.Cheng@flextrade.com<mailto:Ming.Cheng@flextrade.com>>
Sent: Tuesday, January 4, 2022 2:10 AM
To: Ming Cheng <chengm349@hotmail.com<mailto:chengm349@hotmail.com>>
Subject: binary size
Hi,
If I use
g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-rw-r--r-- 1 mcheng flexusr 4632980 Jan 4 09:54 libfilelog.a
If I use
g++ (GCC) 10.2.1 20210130 (Red Hat 10.2.1-11)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-rw-r--r-- 1 mcheng flexusr 7008006 Jan 4 10:08 libfilelog.a
How to reduce binary size generated by C++20 compiler?
You're just looking at the file size, and it's not a binary. The difference is probably due to additional debug info produced by the new GCC. Other things can affect it too, like optimization settings.
Why do you want to reduce it? What is your real goal?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fw: binary size
2022-01-04 11:42 ` Ming Cheng
2022-01-04 11:46 ` Ming Cheng
@ 2022-01-04 12:12 ` Jonathan Wakely
[not found] ` <SI2PR03MB5242FA109CAEDEBF0896B2AAFB4B9@SI2PR03MB5242.apcprd03.prod.outlook.com>
1 sibling, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2022-01-04 12:12 UTC (permalink / raw)
To: Ming Cheng; +Cc: gcc-help
On Tue, 4 Jan 2022 at 11:42, Ming Cheng <chengm349@hotmail.com> wrote:
>
> Hi Jonathan,
> I just pasted a lib. It's applicable to binary. I am wondering whether there is a way to generate smaller binary by ver 10.2.1 close to 7.3.1? Would bigger size binary slower ?
It depends why it's bigger. As I said, it's probably due to debug
info, which doesn't affect performance at all. Using 'ls' to check the
size is not helpful, because it doesn't tell you anything about the
size of the executable code in the binary. Use 'size' to do that. Even
if that shows the code is bigger, that doesn't mean it's going to be
slower. The only way to tell if it's slower is to measure if it's
slower.
tl;dr it depends.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fw: binary size
[not found] ` <SI2PR03MB5242FA109CAEDEBF0896B2AAFB4B9@SI2PR03MB5242.apcprd03.prod.outlook.com>
@ 2022-01-05 8:10 ` Ming Cheng
2022-01-05 8:13 ` Jonathan Wakely
0 siblings, 1 reply; 8+ messages in thread
From: Ming Cheng @ 2022-01-05 8:10 UTC (permalink / raw)
To: gcc-help
________________________________
From: Ming Cheng <chengm349@hotmail.com>
Sent: Wednesday, January 5, 2022 1:17 AM
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Subject: Re: Fw: binary size
Hi Jonathan,
Thanks for this nice advice. I'd like to learn more about cmd size. Among text/data/bss sections, which section(s) has the most impact to the perf? You are right that people should do actual test. But for the same code, in theory, larger size's perf should be always <= smaller size's .
Warm regards
Ming
________________________________
From: Jonathan Wakely <jwakely.gcc@gmail.com>
Sent: Tuesday, January 4, 2022 12:12 PM
To: Ming Cheng <chengm349@hotmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Fw: binary size
On Tue, 4 Jan 2022 at 11:42, Ming Cheng <chengm349@hotmail.com> wrote:
>
> Hi Jonathan,
> I just pasted a lib. It's applicable to binary. I am wondering whether there is a way to generate smaller binary by ver 10.2.1 close to 7.3.1? Would bigger size binary slower ?
It depends why it's bigger. As I said, it's probably due to debug
info, which doesn't affect performance at all. Using 'ls' to check the
size is not helpful, because it doesn't tell you anything about the
size of the executable code in the binary. Use 'size' to do that. Even
if that shows the code is bigger, that doesn't mean it's going to be
slower. The only way to tell if it's slower is to measure if it's
slower.
tl;dr it depends.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fw: binary size
2022-01-05 8:10 ` Ming Cheng
@ 2022-01-05 8:13 ` Jonathan Wakely
2022-01-05 9:15 ` Ming Cheng
0 siblings, 1 reply; 8+ messages in thread
From: Jonathan Wakely @ 2022-01-05 8:13 UTC (permalink / raw)
To: Ming Cheng; +Cc: gcc-help
On Wed, 5 Jan 2022, 08:11 Ming Cheng via Gcc-help, <gcc-help@gcc.gnu.org>
wrote:
>
>
> Hi Jonathan,
>
> Thanks for this nice advice. I'd like to learn more about cmd size. Among
> text/data/bss sections, which section(s) has the most impact to the perf?
> You are right that people should do actual test. But for the same code, in
> theory, larger size's perf should be always <= smaller size's .
>
Not necessarily. Function inlining can increase size but also increase
performance. You need to measure.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Fw: binary size
2022-01-05 8:13 ` Jonathan Wakely
@ 2022-01-05 9:15 ` Ming Cheng
0 siblings, 0 replies; 8+ messages in thread
From: Ming Cheng @ 2022-01-05 9:15 UTC (permalink / raw)
To: Jonathan Wakely, gcc-help; +Cc: gcc-help
Hi Jonathan,
Got it . Newer g++ could handle inline function better for example(plus other improvement); which could also increase binary size. These possibly added code is reflected in text section mostly.
Cheers
Ming
________________________________
From: Jonathan Wakely <jwakely.gcc@gmail.com>
Sent: Wednesday, January 5, 2022 8:13 AM
To: Ming Cheng <chengm349@hotmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Fw: binary size
On Wed, 5 Jan 2022, 08:11 Ming Cheng via Gcc-help, <gcc-help@gcc.gnu.org<mailto:gcc-help@gcc.gnu.org>> wrote:
Hi Jonathan,
Thanks for this nice advice. I'd like to learn more about cmd size. Among text/data/bss sections, which section(s) has the most impact to the perf? You are right that people should do actual test. But for the same code, in theory, larger size's perf should be always <= smaller size's .
Not necessarily. Function inlining can increase size but also increase performance. You need to measure.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-05 9:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <MW3PR18MB3675DED196E7FA7E19455E15804A9@MW3PR18MB3675.namprd18.prod.outlook.com>
2022-01-04 2:12 ` Fw: binary size Ming Cheng
2022-01-04 7:53 ` Jonathan Wakely
2022-01-04 11:42 ` Ming Cheng
2022-01-04 11:46 ` Ming Cheng
2022-01-04 12:12 ` Jonathan Wakely
[not found] ` <SI2PR03MB5242FA109CAEDEBF0896B2AAFB4B9@SI2PR03MB5242.apcprd03.prod.outlook.com>
2022-01-05 8:10 ` Ming Cheng
2022-01-05 8:13 ` Jonathan Wakely
2022-01-05 9:15 ` Ming Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).