Do generic instantiations in multiple units bloat the executable?

Since discussion on SO for following post
http://stackoverflow.com/q/31684300/4267244
has outgrown the media, I am opening this thread to get
to bottom of things.
Rudy, can you post your console app project that shows increase
in exe size when you use TList<Integer> in different units?
-- 
Dalija Prasnikar
0
Dalija
7/28/2015 9:03:37 PM
📁 embarcadero.delphi.non-tech
📃 5933 articles.
⭐ 1 followers.

💬 20 Replies
👁️‍🗨️ 780 Views


> {quote:title=Dalija Prasnikar wrote:}{quote}
> Rudy, can you post your console app project that shows increase
> in exe size when you use TList<Integer> in different units?
Oh wow, this forum is still a thing.
Anyway, I could reproduce this in a simple test case on XE7.1: https://www.dropbox.com/s/7rrc5cdeqaj7dal/GenericCodeSize.zip?dl=0
HOWEVER, it only seems to be due to additional debug info, ie it only happens in Debug mode.
In Debug mode, for each unit I add the generic code to, the resulting exe file increases by about 10k.
In Release mode, for each unit I add the generic code to, the dcu increases from 1k to 39k, but the resulting exe file remains the same.
Cheers
- Asbjørn
0
Utf
7/28/2015 10:51:19 PM
Asbjørn Heid wrote:
> HOWEVER, it only seems to be due to additional debug info, ie it only
> happens in Debug mode.
> 
> In Debug mode, for each unit I add the generic code to, the resulting
> exe file increases by about 10k.
> 
> In Release mode, for each unit I add the generic code to, the dcu
> increases from 1k to 39k, but the resulting exe file remains the same.
It is also possible to check addresses of methods of the same generic
classes defined in different units: if theirs addresses are the same
than there is no real code bloating. (BTW, is there difference if
identical classeses are declared privately in implementation section?
Or if one class is in interface but another one in implementation?)
--
Alex
0
Alex
7/29/2015 5:21:10 AM
Asbjørn Heid wrote:
> HOWEVER, it only seems to be due to additional debug info, ie it only
> happens in Debug mode.
> 
> In Debug mode, for each unit I add the generic code to, the resulting
> exe file increases by about 10k.
> 
> In Release mode, for each unit I add the generic code to, the dcu
> increases from 1k to 39k, but the resulting exe file remains the same.
It is also possible to check addresses of methods of the same generic
classes defined in different units: if theirs addresses are the same
than there is no real code bloating. Or better compare theirs VMT
address with 'is' operator: identical classes should have the same
VMT address ('is' should return true).
BTW, is there difference if identical classeses are declared privately
in implementation sections of diffrerent units? Or if one class is in
interface but another one in implementation of another unit?
--
Alex
Edited by: Alex Belo on Jul 29, 2015 11:52 AM
0
Alex
7/29/2015 5:59:58 AM
Dalija Prasnikar wrote:
> Since discussion on SO for following post
> 
> http://stackoverflow.com/q/31684300/4267244
> 
> has outgrown the media, I am opening this thread to get
> to bottom of things.
> 
> Rudy, can you post your console app project that shows increase
> in exe size when you use TList<Integer> in different units?
The code is not here, so I can't post it now, but I assume it was what
Asbjørn found: additional debug info. And the addresses of methods in
different units are the same, I checked that.
So I was wrong. That is why I deleted my answer in SO.
-- 
Rudy Velthuis        http://www.rvelthuis.de
"They that die by famine die by inches."
 -- Matthew Henry
0
Rudy
7/29/2015 6:31:11 AM
> {quote:title=Rudy Velthuis (TeamB) wrote:}{quote}
> Dalija Prasnikar wrote:
> 
> > Since discussion on SO for following post
> > 
> > http://stackoverflow.com/q/31684300/4267244
> > 
> > has outgrown the media, I am opening this thread to get
> > to bottom of things.
> > 
> > Rudy, can you post your console app project that shows increase
> > in exe size when you use TList<Integer> in different units?
> 
> The code is not here, so I can't post it now, but I assume it was what
> Asbjørn found: additional debug info. And the addresses of methods in
> different units are the same, I checked that.
> 
Thanks for the info. I did extensive testing few years ago, and quick test
yesterday, but your discovery made me think I have missed something.
Since some of my apps have to be as small as possible that would not
be good news. 
I will do some additional testing later on. 
> So I was wrong. That is why I deleted my answer in SO.
You are seldom wrong in matters that are not opinion based, this is just one 
of those times ;-)
-- 
Dalija Prasnikar
0
Dalija
7/29/2015 7:58:27 AM
Rudy Velthuis (TeamB) wrote:
> And the addresses of methods in different units are the same, I
> checked that.
OK, thank you for information.
--
Alex
0
Alex
7/29/2015 8:27:44 AM
Dalija Prasnikar wrote:
> > So I was wrong. That is why I deleted my answer in SO.
> 
> You are seldom wrong in matters that are not opinion based, this is
> just one of those times ;-)
That is correct. And even my opinions are excellent. <g>
-- 
Rudy Velthuis        http://www.rvelthuis.de
"Smith & Wesson - the original point and click interface."
0
Rudy
7/29/2015 9:01:38 AM
Dalija Prasnikar wrote:
> > So I was wrong. That is why I deleted my answer in SO.
> 
> You are seldom wrong in matters that are not opinion based, this is
> just one of those times ;-)
That is correct. And even my opinions are excellent. <g>
-- 
Rudy Velthuis        http://www.rvelthuis.de
"Smith & Wesson - the original point and click interface."
0
Rudy
7/29/2015 9:03:12 AM
Rudy Velthuis (TeamB) wrote:
>  And even my opinions are excellent. <g>
And that is your opinion. <g>

[]s

Cesar Romero
0
Cesar
7/29/2015 5:12:35 PM
Am 29.07.2015 um 11:01 schrieb Rudy Velthuis (TeamB):
> Dalija Prasnikar wrote:
> 
>>> So I was wrong. That is why I deleted my answer in SO.
>>
>> You are seldom wrong in matters that are not opinion based, this is
>> just one of those times ;-)
> 
> That is correct. And even my opinions are excellent. <g>
> 
....at least in your opinion <g>
0
Markus
7/29/2015 6:52:44 PM
> {quote:title=Rudy Velthuis (TeamB) wrote:}{quote}
> Dalija Prasnikar wrote:
> 
> > > So I was wrong. That is why I deleted my answer in SO.
> > 
> > You are seldom wrong in matters that are not opinion based, this is
> > just one of those times ;-)
> 
> That is correct. And even my opinions are excellent. <g>
> 
Only when they coincide with mine ;P
-- 
Dalija Prasnikar
0
Dalija
7/29/2015 7:03:02 PM
Cesar Romero wrote:
> Rudy Velthuis (TeamB) wrote:
> 
> >  And even my opinions are excellent. <g>
> 
> And that is your opinion. <g>
And that is why it is excellent. <g>

-- 
Rudy Velthuis        http://www.rvelthuis.de
"The significant problems we face cannot be solved at the same
 level of thinking we were at when we created them."
 -- Albert Einstein (1879-1955)
0
Rudy
7/30/2015 10:20:52 AM
Markus Humm wrote:
> Am 29.07.2015 um 11:01 schrieb Rudy Velthuis (TeamB):
> > Dalija Prasnikar wrote:
> > 
> >>> So I was wrong. That is why I deleted my answer in SO.
> > > 
> >> You are seldom wrong in matters that are not opinion based, this is
> >> just one of those times ;-)
> > 
> > That is correct. And even my opinions are excellent. <g>
> 
> ...at least in your opinion <g>
And since my opinions are excellent...
-- 
Rudy Velthuis        http://www.rvelthuis.de
"In Germany they first came for the Communists,
 and I didn't speak up because I wasn't a Communist.
 Then they came for the Jews,
 and I didn't speak up because I wasn't a Jew.
 Then they came for the trade unionists,
 and I didn't speak up because I wasn't a trade unionist.
 Then they came for the Catholics,
 and I didn't speak up because I was a Protestant.
 Then they came for me -
 and by that time no one was left to speak up."
 -- Pastor Martin Niemöller
0
Rudy
7/30/2015 10:22:17 AM
Dalija Prasnikar wrote:
> > {quote:title=Rudy Velthuis (TeamB) wrote:}{quote}
> > Dalija Prasnikar wrote:
> > 
> > > > So I was wrong. That is why I deleted my answer in SO.
> > > 
> > > You are seldom wrong in matters that are not opinion based, this
> > > is just one of those times ;-)
> > 
> > That is correct. And even my opinions are excellent. <g>
> > 
> 
> Only when they coincide with mine ;P
Even if they don't.
-- 
Rudy Velthuis        http://www.rvelthuis.de
"Opportunities multiply as they are seized."
 -- Sun tzu
0
Rudy
7/30/2015 10:31:44 AM
Rudy,
| |  ...at least in your opinion <g>
| 
| And since my opinions are excellent...
 ...examples of my personal biases.  <gd&r>
-- 
   Q  --  XanaNews 1.19.1.372 -  2015-07-30 11:01:18
0
Quentin
7/30/2015 6:02:11 PM
Quentin Correll wrote:
> Rudy,
> 
> | |  ...at least in your opinion <g>
> >  
> >  And since my opinions are excellent...
> 
>  ...examples of my personal biases.  <gd&r>
Of your personal biases? Nah, I don't think so.
-- 
Rudy Velthuis        http://www.rvelthuis.de
"The Pope!?! How many divisions has he got?"
 -- Joseph Stalin
0
Rudy
7/31/2015 6:52:19 AM
Rudy,
| > | |  ...at least in your opinion <g>
| |  >  
| |  >  And since my opinions are excellent...
| |  
| |   ...examples of my personal biases.  <gd&r>
| 
| Of your personal biases? Nah, I don't think so.
"my" = Rudy's 

-- 
   Q  --  XanaNews 1.19.1.372 -  2015-07-31 15:28:47
0
Quentin
8/1/2015 10:09:01 PM
Quentin Correll wrote:
> Rudy,
> 
> | > | |  ...at least in your opinion <g>
> | |  >  
> | |  >  And since my opinions are excellent...
> >  |  
> | |   ...examples of my personal biases.  <gd&r>
> >  
> >  Of your personal biases? Nah, I don't think so.
> 
> "my" = Rudy's 
Er, I am Rudy. I'm quite sure. I just asked my wife, and she confirms
it.
-- 
Rudy Velthuis        http://www.rvelthuis.de
"Men have become the tools of their tools."
 -- Henry David Thoreau (1817-1862)
0
Rudy
8/1/2015 11:38:35 PM
Rudy Velthuis (TeamB) wrote:
> Quentin Correll wrote:
> 
> > Rudy,
> > 
> > | > | |  ...at least in your opinion <g>
> > | |  >  
> > | |  >  And since my opinions are excellent...
> > >  |  
> > | |   ...examples of my personal biases.  <gd&r>
> > >  
> > >  Of your personal biases? Nah, I don't think so.
> > 
> > "my" = Rudy's 
> 
> Er, I am Rudy. I'm quite sure. I just asked my wife, and she confirms
> it.
Yes, he is Rudy. I confirm it.
-- 
Rudy Velthuis' wife
0
Rudy
8/2/2015 8:17:53 AM
Rudy,
| Yes, he is Rudy. I confirm it.
| 
| -- 
| Rudy Velthuis' wife
<giggle>
-- 
   Q  --  XanaNews 1.19.1.372 -  2015-08-02 10:27:34
0
Quentin
8/2/2015 5:27:44 PM
Reply: