Closed Bug 822695 Opened 12 years ago Closed 12 years ago

Use nsCOMArray

Categories

(Toolkit :: Telemetry, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: espindola, Assigned: espindola)

Details

Attachments

(2 files)

Attached patch do itSplinter Review
I had discussed array containers for nsCOM objects just before writing this code, but somehow managed to still use std::vector. Using nsCOMArray is fairly ugly, but does seem to be the best we have so far. With this change the text size of Telemetry.o goes from 84042 bytes to 83018 bytes. https://tbpl.mozilla.org/?tree=Try&rev=f05b3a1e1f2d
Attachment #693447 - Flags: review?(ehsan)
Comment on attachment 693447 [details] [diff] [review] do it Review of attachment 693447 [details] [diff] [review]: ----------------------------------------------------------------- Please use nsTArray<nsCOMPtr<...>> instead. r=me with that. (I don't think that you need to change any other part of the patch, but make sure that it builds ;-)
Attachment #693447 - Flags: review?(ehsan) → review+
> Please use nsTArray<nsCOMPtr<...>> instead. r=me with that. (I don't think > that you need to change any other part of the patch, but make sure that it > builds ;-) It doesn't, why were you expecting two array implementations to have similar APIs? :-) So, for size at least nsTArray is the worse: std::vector: 84201 bytes nsCOMPtr: 83177 nsTArray: 84399 Are you sure you want me to switch?
Attached patch use nsTArray.Splinter Review
As noted on the previous comment, this is the worst one for code size :-(
(In reply to comment #2) > > Please use nsTArray<nsCOMPtr<...>> instead. r=me with that. (I don't think > > that you need to change any other part of the patch, but make sure that it > > builds ;-) > > It doesn't, why were you expecting two array implementations to have similar > APIs? :-) > > So, for size at least nsTArray is the worse: > > std::vector: 84201 bytes > nsCOMPtr: 83177 > nsTArray: 84399 > > Are you sure you want me to switch? Did you happen to investigate why that is? Is that because of more templated code?
> > std::vector: 84201 bytes > > nsCOMPtr: 83177 > > nsTArray: 84399 > > > > Are you sure you want me to switch? > > Did you happen to investigate why that is? Is that because of more > templated code? I have not looked at it, sorry. There is probably some interesting missing optimization in nsTArray, but I could not find time to figure it out.
(In reply to comment #5) > > > std::vector: 84201 bytes > > > nsCOMPtr: 83177 > > > nsTArray: 84399 > > > > > > Are you sure you want me to switch? > > > > Did you happen to investigate why that is? Is that because of more > > templated code? > > I have not looked at it, sorry. There is probably some interesting missing > optimization in nsTArray, but I could not find time to figure it out. OK, you can go ahead with the original patch then, this is not important enough to waste too much time on it...
(In reply to Rafael Ávila de Espíndola (:espindola) from comment #2) > > Please use nsTArray<nsCOMPtr<...>> instead. r=me with that. (I don't > > think that you need to change any other part of the patch, but make sure > > that it builds ;-) > > It doesn't, why were you expecting two array implementations to have similar > APIs? :-) That's bug 493711, waiting for review from sicking.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: