Closed
Bug 769504
Opened 11 years ago
Closed 11 years ago
Atomize strings when adding to Map (as a key) or Set
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: jorendorff, Assigned: jorendorff)
References
Details
(Whiteboard: [js:t])
Attachments
(2 files)
5.41 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
2.36 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
HashableValue::setValue is a convenient place to do this. Tradeoffs: - Atomizing takes time. + Without atomizing, every hash table lookup with a string key must take time proportional to the length of the string. With atomizing, there are some cases where lookup can be much faster. + With atomizing, all comparisons are simple 64-bit comparisons. + With atomizing, HashableValue::hash() is always fast, so growing a table can be fast even if there are long string keys. + With atomizing, HashableValue::hash() is so fast that caching a hash code for each entry in the hash table is pointless. (We currently do not cache hash codes anyway; we're just slow.) - Atomizing can make extra copies of strings. + Atomizing can common up strings, saving memory. - Atomizing makes strings in the atom compartment that won't be collected until the next full (runtime-wide) GC. I think we should atomize. (At the same time--I think HashableValue::hash()'s last line can be a little simpler given the changes to ScrambleHashCode in bug 743107. Not sure.)
Updated•11 years ago
|
Whiteboard: [js:t]
Assignee | ||
Comment 1•11 years ago
|
||
Assignee: general → jorendorff
Attachment #638357 -
Flags: review?(luke)
Assignee | ||
Comment 2•11 years ago
|
||
Attachment #638358 -
Flags: review?(luke)
![]() |
||
Updated•11 years ago
|
Attachment #638357 -
Flags: review?(luke) → review+
![]() |
||
Comment 3•11 years ago
|
||
Comment on attachment 638358 [details] [diff] [review] part 1 - atomize, v1 Nice
Attachment #638358 -
Flags: review?(luke) → review+
Assignee | ||
Comment 4•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/926876345186 https://hg.mozilla.org/integration/mozilla-inbound/rev/aec1ad4171a1
Comment 5•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/926876345186 https://hg.mozilla.org/mozilla-central/rev/aec1ad4171a1
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
Comment 6•11 years ago
|
||
I was backing out a number of patches in the js land, and unfortunately this patch caused a number of merge conflicts which I did not trust myself to resolve. Therefore, I had to back it out. Please reland after fixing the conflicts resulting from the backouts. Thanks, and apologies for the inconvenience. Backout changeset: https://hg.mozilla.org/mozilla-central/rev/f6bdb7fc663f
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 7•11 years ago
|
||
Relanded. https://hg.mozilla.org/integration/mozilla-inbound/rev/e5345853fdac
Updated•11 years ago
|
Target Milestone: mozilla16 → mozilla17
Comment 8•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/e5345853fdac
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•