Closed Bug 929494 Opened 11 years ago Closed 11 years ago

use template typedefs, not inheritance, to define nsTArray element copiers

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

There's no reason to use inheritance here, and using plain typedefs avoids massive
amounts of code duplication for the common case of copying with mem*.  Code savings
on Android come in at about 570K (!), or ~2% of libxul .text size, which is a massive
win.
2% codesize win on ARM Android is nothing to sneeze at.
Attachment #820361 - Flags: review?(ehsan)
Benjamin and Taras might be interested in the codesize wins here.
Comment on attachment 820361 [details] [diff] [review]
use template typedefs, not inheritance, to define nsTArray element copiers

Review of attachment 820361 [details] [diff] [review]:
-----------------------------------------------------------------

It is so very sad that this buys us any code size.  :(
Attachment #820361 - Flags: review?(ehsan) → review+
(In reply to :Ehsan Akhgari (needinfo? me!) [Away 10/29-11/6] from comment #3)
> It is so very sad that this buys us any code size.  :(

It oughtn't to on pgo win32; identical code folding should take care of that.  But for all our other platforms...

(Should be some compilation benefits, too, fewer templates/functions and all that.)
(In reply to comment #4)
> (In reply to :Ehsan Akhgari (needinfo? me!) [Away 10/29-11/6] from comment #3)
> > It is so very sad that this buys us any code size.  :(
> 
> It oughtn't to on pgo win32; identical code folding should take care of that. 
> But for all our other platforms...
> 
> (Should be some compilation benefits, too, fewer templates/functions and all
> that.)

Too many should's in the above statements...  Thanks, C++!
(In reply to :Ehsan Akhgari (needinfo? me!) [Away 10/29-11/6] from comment #5)
> Too many should's in the above statements...  Thanks, C++!

Without sarcasm: Thanks, Microsoft!

/be
https://hg.mozilla.org/mozilla-central/rev/8b72c1a37bd6
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
It's surprising this makes a difference on android, as we're building with ICF, there. Did you measure that on a local build? Because we do now disable ICF on local builds, because it slows down linking.
(In reply to Mike Hommey [:glandium] from comment #9)
> It's surprising this makes a difference on android, as we're building with
> ICF, there. Did you measure that on a local build? Because we do now disable
> ICF on local builds, because it slows down linking.

Mmm, I did.  (Also didn't check the szip'd result.)  Well, B2G and Mac builds win libxul size, and everybody else gets smaller objects! ;)
Does that mean that we don't use ICF on b2g?! o_O
(In reply to :Ehsan Akhgari (needinfo? me!) [Away 10/29-11/6] from comment #11)
> Does that mean that we don't use ICF on b2g?! o_O

According to the b2g emulator opt build's configure log I just looked, we do use ICF on b2g.
Assignee: nobody → nfroyd
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: