Closed
Bug 327256
Opened 19 years ago
Closed 19 years ago
Add ability to nsCOMArray to preallocate space
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
People
(Reporter: sicking, Assigned: sicking)
References
Details
Attachments
(1 file, 2 obsolete files)
1.07 KB,
patch
|
darin.moz
:
review+
darin.moz
:
superreview+
darin.moz
:
approval-branch-1.8.1+
|
Details | Diff | Splinter Review |
It'd be nice to have the ability in nsCOMArray to allocate space for a set number of objects. This is useful when inserting a known number of objects since it allows both less error checking and fewer allocations.
Patch comming up.
Assignee | ||
Comment 1•19 years ago
|
||
Not sure if the name is great. Other suggestions welcome.
I should add that I'm going to add code that uses this function soon, so it's not dead code.
Attachment #211957 -
Flags: superreview?(darin)
Attachment #211957 -
Flags: review?(darin)
Comment 2•19 years ago
|
||
Comment on attachment 211957 [details] [diff] [review]
Implement EnsureStorageFor
I think this should be called SetCapacity to be more consistent with other container classes (e.g., nsString and nsTArray).
Assignee | ||
Comment 3•19 years ago
|
||
Attachment #211957 -
Attachment is obsolete: true
Attachment #212024 -
Flags: superreview?(darin)
Attachment #212024 -
Flags: review?(darin)
Attachment #211957 -
Flags: superreview?(darin)
Attachment #211957 -
Flags: review?(darin)
Assignee | ||
Comment 4•19 years ago
|
||
Comment on attachment 212024 [details] [diff] [review]
Better name
Hmm.. looking at strings i'm not sure if the name is ideal as the function is implemented.
nsTSubstring::SetCapacity currently sets the capacity to
NS_MIN(mLength, aSize)
whereas this code sets it to
mLength + aSize
New patch coming up.
Attachment #212024 -
Attachment is obsolete: true
Attachment #212024 -
Flags: superreview?(darin)
Attachment #212024 -
Flags: review?(darin)
Assignee | ||
Comment 5•19 years ago
|
||
So nsTSubstring::SetCapacity and nsTArray::SetCapacity behave differently. The nsTSubstring one will reduce the length of the string if it can't fit in the new capacity, nsTArray will simply never make the capacity smaller then mLength.
I made nsCOMArray behave like nsTArray
Attachment #212151 -
Flags: superreview?(darin)
Attachment #212151 -
Flags: review?(darin)
Updated•19 years ago
|
Attachment #212151 -
Flags: superreview?(darin)
Attachment #212151 -
Flags: superreview+
Attachment #212151 -
Flags: review?(darin)
Attachment #212151 -
Flags: review+
It'd be nice to have this on the 1.8 and 1.8.0 branches for bug 271669.
Blocks: 271669
Comment 7•19 years ago
|
||
Comment on attachment 212151 [details] [diff] [review]
patch v2
a=darin for 1.8.1
Attachment #212151 -
Flags: approval-branch-1.8.1+
I just landed this on MOZILLA_1_8_BRANCH and (without approval) MOZILLA_1_8_0_BRANCH so that I could land bug 271669.
Assignee | ||
Comment 9•19 years ago
|
||
This was checked in some time ago
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•