Closed
Bug 1442480
Opened 6 years ago
Closed 6 years ago
Switch nsNodeInfoHash to a nsDataHashTable
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: erahm, Assigned: erahm)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
14.13 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
We should really avoid using PL_Hash if possible. Converting `nsNodeInfoHash` is pretty straightforward.
Assignee | ||
Comment 1•6 years ago
|
||
try with talos: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6faed20718c39a96cd2244195579efdd7cc8deb4
Assignee | ||
Comment 2•6 years ago
|
||
This switches `nsNodeInfoHash` to a nsDataHashTable. The hash function and equality operator are moved to NodeInfoInner so that they can be easily reused.
Attachment #8955370 -
Flags: review?(bugs)
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → erahm
Status: NEW → ASSIGNED
Comment 3•6 years ago
|
||
Comment on attachment 8955370 [details] [diff] [review] Switch nsNodeInfoHash to a nsDataHashTable I don't understand why you get rid of mHashInitialized. Am I missing something, is the hash value cached somewhere else?
Attachment #8955370 -
Flags: review?(bugs) → review-
Assignee | ||
Comment 4•6 years ago
|
||
(In reply to Olli Pettay [:smaug] (unusual timezone [JST] for a week) from comment #3) > Comment on attachment 8955370 [details] [diff] [review] > Switch nsNodeInfoHash to a nsDataHashTable > > I don't understand why you get rid of mHashInitialized. > Am I missing something, is the hash value cached somewhere else? Yes the hash value is cached in the hash table entry [1], it's cached for lookups if the key is an atom [2], but it won't be cached for lookups by string name [3] (where we calculate the hash for the MRU table and then again for the table lookup). So if it's in MRU or the key is an atom it's a non-issue. I can add it back, but it seemed overkill. I know Ehsan added as a perf improvement but given the underlying entry type caches now I wasn't sure if we wanted/needed the cache.
Assignee | ||
Comment 5•6 years ago
|
||
Sorry, references: [1] https://searchfox.org/mozilla-central/rev/bffd3e0225b65943364be721881470590b9377c1/xpcom/ds/PLDHashTable.h#44 [2] https://searchfox.org/mozilla-central/rev/bffd3e0225b65943364be721881470590b9377c1/xpcom/ds/nsAtom.h#76 [3] https://searchfox.org/mozilla-central/rev/bffd3e0225b65943364be721881470590b9377c1/dom/base/nsNodeInfoManager.cpp#290
Comment 6•6 years ago
|
||
This is rather hot code, so I'm just trying to understand in which cases we don't use that cache. Even before ehsan's changes hash was cached for atoms. But with this new setup, whenever we add a new thing, we calculate the hash twice. First to check whether we're in mRecentlyUsedNodeInfos and then when adding to the hashtable. I don't really see reason to remove the optimization ehsan added.
Assignee | ||
Comment 7•6 years ago
|
||
(In reply to Olli Pettay [:smaug] (unusual timezone [JST] for a week) from comment #6) > This is rather hot code, so I'm just trying to understand in which cases we > don't use that cache. > Even before ehsan's changes hash was cached for atoms. > > But with this new setup, whenever we add a new thing, we calculate the hash > twice. > First to check whether we're in mRecentlyUsedNodeInfos and then when adding > to the hashtable. > I don't really see reason to remove the optimization ehsan added. I wanted to avoid storing the hash twice; given it's hot code I'll add it back.
Assignee | ||
Comment 8•6 years ago
|
||
I added the cached hash back as a Mabye<uint32_t> and removed a perf TODO comment as we are caching again.
Attachment #8957016 -
Flags: review?(bugs)
Assignee | ||
Updated•6 years ago
|
Attachment #8955370 -
Attachment is obsolete: true
Comment 9•6 years ago
|
||
Comment on attachment 8957016 [details] [diff] [review] Switch nsNodeInfoHash to a nsDataHashTable >+ uint32_t Hash() const { Nit, { goes to its own line
Attachment #8957016 -
Flags: review?(bugs) → review+
Comment 10•6 years ago
|
||
Pushed by erahm@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/ea89e8713941 Switch nsNodeInfoHash to a nsDataHashTable. r=smaug
Comment 11•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ea89e8713941
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox60:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•