Closed Bug 188828 Opened 22 years ago Closed 21 years ago

nsAutoString's constructors are slow

Categories

(Core :: XPCOM, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.7alpha

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Keywords: perf, Whiteboard: [patch])

Attachments

(1 file, 2 obsolete files)

nsAutoString's constructors have always shown up in profiles more than one would think they ought to. I'll attach a patch I wrote to attempt to speed them up, written while investigating bug 188224, using an idea I described in bug 162017 comment 20.
Status: NEW → ASSIGNED
Priority: -- → P2
Whiteboard: [patch]
Target Milestone: --- → mozilla1.3beta
Attached patch patch, ugly version (obsolete) — Splinter Review
This is the ugly version. I'll make a cleaner version later -- what I should really do is just make an inline, protected, constructor of ns[C]String that takes the same parameters as nsStrPrivate::Initialize and calls it with those parameters.
Except that wouldn't handle the CBufDescriptor case very easily...
feel free to rip apart nsStrPrivate::Inititalize - nobody likes nsStr/nsStrPrivate anyway.
(So is this patch too ugly to land?)
Attached patch patch (obsolete) — Splinter Review
Previous patch, updated to trunk.
Attachment #111368 - Attachment is obsolete: true
Comment on attachment 139855 [details] [diff] [review] patch This is ugly, but it should be a measurable performance win. Based on my memory from quite a while ago and comment 3, it would be hard to do this more cleanly without getting rid of CBufDescriptor, although I don't remember why...
Attachment #139855 - Flags: review?(darin)
Ah, right. What makes it hard is that the constructor taking a CBufDescriptor does the initialization in one of two different ways, which is hard to do with constructor calls (although it is possible, I admit, but perhaps even uglier than this).
Comment on attachment 139855 [details] [diff] [review] patch Actually, never mind. I can get rid of the null checks.
Attachment #139855 - Flags: review?(darin)
Attached patch patchSplinter Review
Attachment #139855 - Attachment is obsolete: true
Target Milestone: mozilla1.3beta → mozilla1.7alpha
heh, funny - I feel like I had a similar patch in my tree at one point maybe a year ago.. I like everything that is done here. oh, to be rid of eCharSize once and for all... *sigh* :)
Comment on attachment 139858 [details] [diff] [review] patch r=darin, though i'm hoping to change all this code shortly ;)
Attachment #139858 - Flags: review?(darin) → review+
Comment on attachment 139858 [details] [diff] [review] patch sr=alecf
Attachment #139858 - Flags: superreview?(alecf) → superreview+
Fix checked in to trunk, 2004-01-28 20:00 -0800.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: