object file size is reduced after build #2

  • Follow


Hi all,


We have large code  on which we are solving the bugs. For every bug we
change the code part either add or delete some of the code part. More
is adding the code part and very less is deleting the code.

But the question is , after build the object file( changed code) size
is less than the object file ( unchanged code)???.  As we increased
the lines of code the object file size should be increased but here it
is decresing .. why?

Is these issue with the optimization? as we are doing with
optimization 2.


Thanks in advance,
jayapal
0
Reply jayapal403 (24) 12/18/2007 8:20:41 AM

jayapal wrote:

> Hi all,
> 
> We have large code  on which we are solving the bugs. For every bug we
> change the code part either add or delete some of the code part. More
> is adding the code part and very less is deleting the code.
> 
> But the question is , after build the object file( changed code) size
> is less than the object file ( unchanged code)???.  As we increased
> the lines of code the object file size should be increased but here it
> is decresing .. why?
> 
> Is these issue with the optimization? as we are doing with
> optimization 2.

Why don't you ask your development team instead of expecting a bunch of
random people to divine the characteristics of your build environment?

0
Reply santosh.k83 (3969) 12/18/2007 9:30:07 AM


jayapal wrote:

> But the question is , after build the object file( changed code) size
> is less than the object file ( unchanged code)???.  As we increased
> the lines of code the object file size should be increased but here it
> is decresing .. why?

Compare the assembly output for both versions and see.

-- 
Thad
0
Reply ThadSmith (1279) 12/18/2007 12:28:02 PM

jayapal wrote:
> Hi all,
> 
> 
> We have large code  on which we are solving the bugs. For every bug we
> change the code part either add or delete some of the code part. More
> is adding the code part and very less is deleting the code.
> 
> But the question is , after build the object file( changed code) size
> is less than the object file ( unchanged code)???.  As we increased
> the lines of code the object file size should be increased but here it
> is decresing .. why?
> 
> Is these issue with the optimization? as we are doing with
> optimization 2.

There's no simple predictable relationship between the amount of source 
code and the size of the object module. If your improvements were ones 
that made it easier for the compiler to optimize for a smaller object 
module, adding source code could indeed reduce the size of the object 
module. I would also, however, recommend verifying that you compiled 
with exactly the same compiler options; if you didn't, all bets are off 
when comparing object module sizes. In particular, if the previous 
compilation had been in debug mode, and the new one was in normal mode, 
you should see a large decrease in size.
0
Reply jameskuyper (5171) 12/18/2007 12:37:44 PM

On Dec 18, 5:37 pm, James Kuyper <jameskuy...@verizon.net> wrote:
> jayapal wrote:
> > Hi all,
>
> > We have large code  on which we are solving the bugs. For every bug we
> > change the code part either add or delete some of the code part. More
> > is adding the code part and very less is deleting the code.
>
> > But the question is , after build the object file( changed code) size
> > is less than the object file ( unchanged code)???.  As we increased
> > the lines of code the object file size should be increased but here it
> > is decresing .. why?
>
> > Is these issue with the optimization? as we are doing with
> > optimization 2.
>
> There's no simple predictable relationship between the amount of source
> code and the size of the object module. If your improvements were ones
> that made it easier for the compiler to optimize for a smaller object
> module, adding source code could indeed reduce the size of the object
> module. I would also, however, recommend verifying that you compiled
> with exactly the same compiler options; if you didn't, all bets are off
> when comparing object module sizes. In particular, if the previous
> compilation had been in debug mode, and the new one was in normal mode,
> you should see a large decrease in size.

 Thanks for ur information. Can you explain clearly what is debug mode
what is the usage of it.
0
Reply jayapal403 (24) 12/18/2007 1:11:35 PM

jayapal wrote:

> On Dec 18, 5:37 pm, James Kuyper <jameskuy...@verizon.net> wrote:
>> jayapal wrote:
>> > Hi all,
>>
>> > We have large code  on which we are solving the bugs. For every bug
>> > we change the code part either add or delete some of the code part.
>> > More is adding the code part and very less is deleting the code.
>>
>> > But the question is , after build the object file( changed code)
>> > size
>> > is less than the object file ( unchanged code)???.  As we increased
>> > the lines of code the object file size should be increased but here
>> > it is decresing .. why?
>>
>> > Is these issue with the optimization? as we are doing with
>> > optimization 2.
>>
>> There's no simple predictable relationship between the amount of
>> source code and the size of the object module. If your improvements
>> were ones that made it easier for the compiler to optimize for a
>> smaller object module, adding source code could indeed reduce the
>> size of the object module. I would also, however, recommend verifying
>> that you compiled with exactly the same compiler options; if you
>> didn't, all bets are off when comparing object module sizes. In
>> particular, if the previous compilation had been in debug mode, and
>> the new one was in normal mode, you should see a large decrease in
>> size.
> 
>  Thanks for ur information. Can you explain clearly what is debug mode
> what is the usage of it.

Not in general because the exact characteristics of "debug mode" will
vary between implementations and compilations. Usually, in "debug mode"
assert invocations are defined, other debugging routines written for
the program are called, all debugging symbols are compiled into the
object code, optimisation is eliminated or reduced, and so on.

In particular the inclusion of debugging information into the object
files can cause a dramatic size difference between outputs of
compilation with debugging mode toggled. asserts and other programmer
defined debugging code can also consume significant code and data
space.

0
Reply santosh.k83 (3969) 12/18/2007 1:18:05 PM

5 Replies
32 Views

(page loaded in 0.091 seconds)


Reply: