Closed Bug 108597 Opened 23 years ago Closed 23 years ago

shrink nsStr

Categories

(Core :: XPCOM, defect, P1)

x86
Windows 2000
defect

Tracking

()

RESOLVED FIXED
mozilla0.9.6

People

(Reporter: alecf, Assigned: alecf)

References

Details

(Whiteboard: fix in hand)

Attachments

(1 file)

Man! Has anyone noticed that: 1) nsStr counts for 10M out of 25M in the bloat logs 2) nsStr is 20 bytes long 3) 8 bytes of nsStr are used for two booleans (mCharSize and mOwnsBuffer) With a simple 10-15 line change, I can shrink nsStr to 16 bytes, by making mCharSize a PRInt8 and making mOwnsBuffer a PRPackedBool, both 8 bytes. Rounded up to the nearest 4 bytes, these two variables still take 4 bytes, but it will save about 2 Megs in the bloat logs on tinderbox. I'm going to work on further reductions to roll these two boolean variables into the high bytes of mLength and mCapacity, reducing this object to a mere 8 bytes, but I'd like to get this short patch into 0.9.6 right now.
oops, assign to myself, I have the fix
Assignee: dougt → alecf
Priority: -- → P1
Target Milestone: --- → mozilla0.9.6
Attached patch shrink nsStr by 4 bytes (deleted) — Splinter Review
I totally mucked up indentation in nsStr.h, but I'll fix that before landing.
cc'ing waterson for an sr=
Attachment #56622 - Flags: superreview+
sr=waterson
Comment on attachment 56622 [details] [diff] [review] shrink nsStr by 4 bytes Sure, low fruit. r=jag
Attachment #56622 - Flags: superreview+ → review+
Whiteboard: fix in hand
in my tree, I also moved mCharSize and mOwnsBuffer after mStr/mUStr to make sure mStr/mUStr stay aligned (dumb compilers might not)
Status: NEW → ASSIGNED
thanks guys, fixed!
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Blocks: 92580
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: