Closed
Bug 583729
Opened 14 years ago
Closed 7 months ago
js hashtable - ability to reserve
Categories
(Core :: JavaScript Engine, enhancement)
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: igor, Unassigned)
Details
It would be nice to add to HashTable and HashSet a method similar to Vector::reserve that would guarantee that the following additions to the table would always succeed. The current init method allows to do that only during initialization which is insufficient.
Comment 1•14 years ago
|
||
One problem is that if reserve simply makes the table bigger, and the user does a remove before reaching the reserved size, then checkUnderloaded would shrink the table back down.
Reporter | ||
Comment 2•14 years ago
|
||
(In reply to comment #1) > One problem is that if reserve simply makes the table bigger, and the user does > a remove before reaching the reserved size, then checkUnderloaded would shrink > the table back down. This is fine as my use case is to avoid writing the release operation in code like: key = prepare_key(); if (!key) return false; if (!hashtable.put(key, value)) { release_key(key); return false; } With reserve that would be if (!hashtable.reserve(length() + 1)) return false; key = prepare_key(); if (!key) return false; hashtable.put(key, value);
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Updated•2 years ago
|
Severity: normal → S3
Updated•7 months ago
|
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•