Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: BCB6 vs. 10.1 code size


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 8 - Last Post: Jan 8, 2018 12:30 PM Last Post By: Alan Kamrowski,... Threads: [ Previous | Next ]
Alan Kamrowski,...

Posts: 30
Registered: 6/16/99
BCB6 vs. 10.1 code size  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2017 7:26 PM
I have a VCL forms application that compiles to 780K for BCB6, and 3651K for 10.1.

Are there any default settings in 10.1 that would have affected this?
Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: BCB6 vs. 10.1 code size  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 28, 2017 11:33 PM   in response to: Alan Kamrowski,... in response to: Alan Kamrowski,...
Hi Alan

Alan Kamrowski, II wrote:

I have a VCL forms application that compiles to 780K for BCB6, and 3651K for 10.1.

Are there any default settings in 10.1 that would have affected this?

Don't think so and if you look at the disk usage especially if you
use 32 bit debug and release + 64 bit debug and release you will
see that the 100MB mark quickly is passed :(

Best regards
Asger
Alan Kamrowski,...

Posts: 30
Registered: 6/16/99
Re: BCB6 vs. 10.1 code size  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2017 5:37 AM   in response to: Asger Joergensen in response to: Asger Joergensen
Don't think so and if you look at the disk usage especially if you
use 32 bit debug and release + 64 bit debug and release you will
see that the 100MB mark quickly is passed :(

What I find odd is that debugging on = 3658K, debugging off = 3651K. This doesn't seem normal, but yet between debug/release mode I can see these changes for debug:

C++ compiler, debugging, debug info=on, debug line=on, codeguard=on
Linker, full debug info=on

Interestingly, C++builder6 produced a very small difference in code size between debug and release as well, around 7K or 8K.

Even if I turn on runtime packages/dynamic RTL, their code sizes are 165K vs 264K.

I guess over time it all goes up up up.
Jan Dijkstra

Posts: 206
Registered: 11/4/99
Re: BCB6 vs. 10.1 code size  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2017 5:52 AM   in response to: Alan Kamrowski,... in response to: Alan Kamrowski,...
Alan Kamrowski, II wrote:
Don't think so and if you look at the disk usage especially if you
use 32 bit debug and release + 64 bit debug and release you will
see that the 100MB mark quickly is passed :(

What I find odd is that debugging on = 3658K, debugging off = 3651K. This doesn't seem normal, but yet between debug/release mode I can see these changes for debug:

C++ compiler, debugging, debug info=on, debug line=on, codeguard=on
Linker, full debug info=on

Interestingly, C++builder6 produced a very small difference in code size between debug and release as well, around 7K or 8K.

Even if I turn on runtime packages/dynamic RTL, their code sizes are 165K vs 264K.

I guess over time it all goes up up up.

What you should be looking at is the overall size of the code segment(s), because that's what ultimately gets loaded into memory for execution. Use ProcessExplorer or likewise tool for that. My guess is that you won't find much difference there.
Alan Kamrowski,...

Posts: 30
Registered: 6/16/99
Re: BCB6 vs. 10.1 code size  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2017 6:08 AM   in response to: Jan Dijkstra in response to: Jan Dijkstra
What you should be looking at is the overall size of the code segment(s), because that's what ultimately gets loaded into memory for execution.
Use ProcessExplorer or likewise tool for that. My guess is that you won't find much difference there.

Is the map file a good indicator for segment size?

CPPB10.2U2:
Start Length Name Class
0001:00401000 0002FCE90H _TEXT CODE
0002:006FE000 00001A1CCH _DATA DATA
0003:007181CC 000026648H _BSS BSS
0004:00000000 0000000F8H _TLS TLS

CPPB6:
Start Length Name Class
0001:00401000 0000936FCH _TEXT CODE
0002:00495000 00000D434H _DATA DATA
0003:004A2434 000008D24H _BSS BSS
0004:00000000 0000000B4H _TLS TLS
Alan Kamrowski,...

Posts: 30
Registered: 6/16/99
Re: BCB6 vs. 10.1 code size - COULD THIS BE WHY?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 8, 2018 5:39 AM   in response to: Alan Kamrowski,... in response to: Alan Kamrowski,...
One thing I noticed with 10.1/10.2 C++ Builder is that its executable sizes were vastly larger than what cppbuilder6 produces, and I know there are valid reasons for this such as VCL and UNICODE, but another reason is that 10.1/10.2 doesn't seem to be excluding unused functions. If I make a large function with cppbuilder6 and do not call it, it will not be linked into the executable, but if I repeat this same test with 10.1/10.2, the function is present. Is there an option to cause the linker to optimize out unused functions?
Alan Kamrowski,...

Posts: 30
Registered: 6/16/99
Re: BCB6 vs. 10.1 code size - COULD THIS BE WHY?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 8, 2018 5:39 AM   in response to: Alan Kamrowski,... in response to: Alan Kamrowski,...
One thing I noticed with 10.1/10.2 C++ Builder is that its executable sizes were vastly larger than what cppbuilder6 produces, and I know there are valid reasons for this such as VCL and UNICODE, but another reason is that 10.1/10.2 doesn't seem to be excluding unused functions. If I make a large function with cppbuilder6 and do not call it, it will not be linked into the executable, but if I repeat this same test with 10.1/10.2, the function is present. Is there an option to cause the linker to optimize out unused functions?
Alan Kamrowski,...

Posts: 30
Registered: 6/16/99
Re: BCB6 vs. 10.1 code size - COULD THIS BE WHY?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 8, 2018 10:21 AM   in response to: Alan Kamrowski,... in response to: Alan Kamrowski,...
So in cppbuilder6, if you enable codeguard and turn on the "validate global and stack accesses", it will include unused functions (bloating executable size). If you turn it off, it will exclude them. The code is still compiled into the obj file, it seems that the linker is smart enough not to link it in.

In 10.2 though I don't see the same functionality - eve with codeguard turned off, it still links in unused functions. Any idea on how to not link unused functions with 10.2?
Alan Kamrowski,...

Posts: 30
Registered: 6/16/99
Re: BCB6 vs. 10.1 code size - COULD THIS BE WHY?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 8, 2018 12:30 PM   in response to: Alan Kamrowski,... in response to: Alan Kamrowski,...
Ok, so 10.2 does also work the same way cppbuilder6 did. The codeguard option mentioned keeps unused functions, when turned off, the unused functions are not linked in.

Why was my earlier test with 10.2 and release mode (codeguard option off) still linking in an unused function? I traced it down to linking in a library. If I include xmlrtl.lib, then it links the unused function, if I do not, then it does not. So something in xmlrtl.lib is causing the linker to decide to include the unused function when it doesn't need to... Could the xmlrtl.lib have codeguard turned on?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02