Closed Bug 153754 Opened 22 years ago Closed 22 years ago

nsPersistentProperties should use arena-allocated strings

Categories

(Core :: XPCOM, defect, P2)

x86
Windows 2000
defect

Tracking

()

RESOLVED FIXED
mozilla1.1beta

People

(Reporter: alecf, Assigned: alecf)

References

Details

(Whiteboard: fix in hand)

Attachments

(1 file, 1 obsolete file)

Right now, nsPersistentProperties uses both malloc-allocated strings and the old-sk00l nspr hash tables. Persistent properties are generally just read in as one big block, and then kept around for the life of the object - this calls for an arena! While I'm there, I'm switching over to PLDHashTable. patch forthcoming.
Attached patch switch to arena and pldhash (obsolete) (deleted) — Splinter Review
This switches us over to arenas and PLDHashTable.. the other thing I did while I was there was to store property keys in char* - since 99% of the time, they key is ASCII - however I did the right thing as far as the UCS2/UTF8 conversion on the off chance that they key isn't ASCII. at some point I'd like to switch this over entirely to ASCII keys, which means dropping the whole use of NS_NewUTF8ConverterStream, but I'll get to that in another bug.
(that conversion will be the subject of bug 121341) dougt / dveditz, can I get a review here?
Blocks: 121341
Status: NEW → ASSIGNED
Whiteboard: fix in hand
(Sorry for the additional bug spam) ignore the printf and associated counting variables - I removed them from my local tree and forgot to update the patch before attaching :(
oh, and this reduces number of string bundle-related allocations at startup from about 1100 to about 20, including the actual string bundle objects, so we should get some performance benefits here, we'll use less memory for the keys (500 or so of average size 12 bytes reduced to 6 bytes, a savings of about 3k) and we'll fragment the heap a whole lot less because all the old allocations were very small strings (8-32 bytes for keys, 12-100 bytes for values)
Priority: -- → P2
Target Milestone: --- → mozilla1.1beta
duh, I wasn't including the null terminator in my ArenaStrdup()
Attachment #88865 - Attachment is obsolete: true
Comment on attachment 89173 [details] [diff] [review] updated patch - null terminate correctly get rid of the printf's looks fine r=dougt
Attachment #89173 - Flags: review+
Comment on attachment 89173 [details] [diff] [review] updated patch - null terminate correctly sr=dveditz
Attachment #89173 - Flags: superreview+
yup, printf has been removed :) fix is in!
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Depends on: 1233566
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: