Closed
Bug 972601
Opened 10 years ago
Closed 10 years ago
Convert nsTreeStyleCache::mTransitionTable and ::mCache to more modern hashtables
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
RESOLVED
FIXED
mozilla32
People
(Reporter: mccr8, Assigned: mccr8)
References
Details
Attachments
(6 files)
1.62 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
3.66 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
2.19 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
4.30 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
7.22 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
6.21 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
This is somewhat odd. There are two hash tables, one representing a finite state machine, and one representing some kind of cache of results for the finite state machine. This involves two custom hashtable key classes, nsDFAState and nsTransitionKey. The first one is odd because the things it can hold are from a linearly allocated set of integers, and the hash function is just the identity. I guess because it is used for the cache, they wanted the lookup to be fast? But I'm guessing it is okay to just replace it with a regular integer hash class. nsTransitionKey is a pair, of an int and a COMPtr. I'm not sure if there's a newer hashtable key class that allows pairs, or if one will have to be created. This code is old, and landed as part of a big refactoring, so digging around in the history for it didn't clarify anything for me.
Comment 1•10 years ago
|
||
I think it's ok to replace the custom hash code. But this code needs to be performant -- it will be called many times during painting.
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → continuation
Assignee | ||
Comment 2•10 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=8797b19a1ecd
Assignee | ||
Comment 3•10 years ago
|
||
L64 debug try run: https://tbpl.mozilla.org/?tree=Try&rev=8797b19a1ecd
Attachment #8411088 -
Flags: review?(dbaron)
Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8411089 -
Flags: review?(dbaron)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8411090 -
Flags: review?(dbaron)
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8411091 -
Flags: review?(dbaron)
Assignee | ||
Comment 7•10 years ago
|
||
This also turns nsTransitionKey into an inner class of nsStyleContext, and changes it from an nsHashKey to a class to be used with nsGenericHashKey. It also changes the intermediate values of the hash computation to uints, instead of signed ints, as that seems more right.
Attachment #8411092 -
Flags: review?(dbaron)
Assignee | ||
Comment 8•10 years ago
|
||
It is now a pointless wrapper around uint32_t.
Attachment #8411093 -
Flags: review?(dbaron)
Attachment #8411088 -
Flags: review?(dbaron) → review+
Attachment #8411089 -
Flags: review?(dbaron) → review+
Attachment #8411090 -
Flags: review?(dbaron) → review+
Attachment #8411091 -
Flags: review?(dbaron) → review+
Comment on attachment 8411092 [details] [diff] [review] part 5 - Convert nsTreeStyleCache::mTransitionTable to nsClassHashtable. >Bug 972601, part 5 - Convert nsTreeStyleCache::mTransitionTable to nsClassHashtable. r=dbaron > >This also turns nsTransitionKey into an inner class of nsStyleContext, and changes it from an nsHashKey to a class to be used with nsGenericHashKey. of nsTreeStyleCache, not nsStyleContext >+bool nsTreeStyleCache::Transition::operator==(const Transition& aOther) const newline after bool >+{ >+ return aOther.mState == mState && aOther.mInputSymbol == mInputSymbol; >+} >+ >+uint32_t nsTreeStyleCache::Transition::Hash() const newline after uint32_t I spent a bit of time checking that what both APIs expected from their Hash()/HashCode() function was the same, but it should have been obvious since they both use pldhash. (i.e., no need to use the MFBT AddToHash functions) r=dbaron But please test that trees still paint reasonably after your patch, since we have almost no test coverage for it. Look at, say, the bookmarks sidebar, about:config, and some of the things in the preferences UI. (Also, it would probably be good to double-check that you're still hitting the cache at similar rates.)
Attachment #8411092 -
Flags: review?(dbaron) → review+
Attachment #8411093 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 10•10 years ago
|
||
Thanks for the reviews. (In reply to David Baron [:dbaron] (needinfo? me) (UTC-7) from comment #9) > of nsTreeStyleCache, not nsStyleContext > newline after bool > newline after uint32_t Done. > But please test that trees still paint reasonably after your patch, since we > have almost no test coverage for it. Look at, say, the bookmarks sidebar, > about:config, and some of the things in the preferences UI. > > (Also, it would probably be good to double-check that you're still hitting > the cache at similar rates.) I looked around at those things you mentioned (I wasn't really sure what this code was for), and they look okay. The cache rate looks more or less the same, too. I'll land after the trees open.
Assignee | ||
Comment 11•10 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/3389cea57d49 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/5d1f1d5ff06c remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/4cfc79c744f8 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/838156914c6d remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/4a54846d5ad6 remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/40532c120293
Comment 12•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/3389cea57d49 https://hg.mozilla.org/mozilla-central/rev/5d1f1d5ff06c https://hg.mozilla.org/mozilla-central/rev/4cfc79c744f8 https://hg.mozilla.org/mozilla-central/rev/838156914c6d https://hg.mozilla.org/mozilla-central/rev/4a54846d5ad6 https://hg.mozilla.org/mozilla-central/rev/40532c120293
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in
before you can comment on or make changes to this bug.
Description
•