Closed
Bug 688500
Opened 15 years ago
Closed 8 years ago
Arrays should not discard constructor length "hint" when its reasonable in size.
Categories
(Tamarin Graveyard :: Library, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: pnkfelix, Unassigned)
References
Details
new Array(1000) effectively does this:
this.length = 1000;
and lets the length setter handle maintenance of the array's storage.
The length setter in turn says this:
if (m_denseArray.length() == 0 && oldLength == 0)
{
// We are "dense" but actually empty; we usually get
// here when constructing a new array with an initial length.
// Don't pre-allocate a dense size, since we don't know
// if the Array will end up being dense or not, and requests
// to pre-allocate large arrays might waste memory.
//
// OPTIMIZEME: might make sense to preallocate sizes that are
// larger than MIN_SPARSE_INDEX but still "small", on the assumption
// that most arrays are dense?
I hypothesize it would make to do such preallocation. Of course, we'd have to determine what good thresholds for "small" are. (FYI: MIN_SPARSE_INDEX is 32.)
(On the other hand, do applications allocate/grow a lot of arrays? Certainly our array reading/writing microbenchmarks do not. If real applications tend not to allocate fresh arrays, then there may be better yields elsewhere.)
| Reporter | ||
Updated•15 years ago
|
Blocks: array-tracker
Comment 1•8 years ago
|
||
Tamarin isn't maintained anymore. WONTFIX remaining bugs.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•