Closed
Bug 576136
Opened 16 years ago
Closed 16 years ago
Consider storing nsTArray<RuleValue> in rulehash instead of linked lists
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
RESOLVED
FIXED
mozilla2.0b2
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
(Blocks 1 open bug)
Details
(Keywords: perf)
Attachments
(1 file)
|
31.59 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
We end up with a fair number of L2 cache misses for the mBackwardsIndex of rule values right now in EnumerateAllRules. Perhaps we should use nsTArray<RuleValue> instead of the current linked lists?
| Assignee | ||
Comment 1•16 years ago
|
||
This speeds up my "reframe the html5 single-page spec" testcase by about 1.5-2%. About 60% of that is style resolution, if I recall correctly, so the speedup in style resolution is 3-4% or so. Not a lot, but something....
That metric does NOT measure the time needed to construct the rulehash; if you want me to do some measurements on that I can try, but I'm not sure we have existing tests for it.
Comment on attachment 455613 [details] [diff] [review]
Perhaps like this
>+static void RuleHash_ClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
newline after static void
>+ (static_cast<RuleHashTableEntry*>(entry))->~RuleHashTableEntry();
and no extra ()... although it might make more sense to use the
hdr/entry pattern that the rest use
(and the same for the existing RuleHash_TagTable_ClearEntry)
>+ RuleValue* value = mUniversalRules.Elements() + i;
Probably clearer to do = &(mUniversalRules[i]);
I think it would be a little nicer to make AddRule, AppendRule,
and Append* take a const RuleSelectorPair& instead of const
RuleSelectorPair*, though I'm ok with keeping it.
It might be nice to simplify AppendRuleToTagTable as a followup.
> #define RULE_HASH_STAT_INCREMENT_LIST_COUNT(list_, var_) \
>- do { ++(var_); (list_) = (list_)->mNext; } while (list_)
>+ var_ += (list_).Length()
> #else
Parenthesize (var_)
The EnumData construction pattern from an nsTArray in EnumerateAllRules
is a little repetitive. It might be nice to simplify it using an inline
function.
Drop the extra parens in ClearWeightEntry (and maybe use the hdr/entry
pattern too).
r=dbaron
Attachment #455613 -
Flags: review?(dbaron) → review+
| Assignee | ||
Comment 3•16 years ago
|
||
> newline after static void
Done.
> although it might make more sense to use the hdr/entry pattern that the rest use
Done.
> Probably clearer to do = &(mUniversalRules[i]);
Yeah, I always sorta hate taking pointers to references. Will do, though.
> I think it would be a little nicer to make AddRule, AppendRule,
> and Append* take a const RuleSelectorPair&
OK, will do. I'd been semi-trying to minimize the changes to make this easier to review. I'm not changing AddRule(), because that doesn't take a const argument, since it actually modifies it in the pseudo-element case.
> It might be nice to simplify AppendRuleToTagTable as a followup.
Simplify which part of it?
> Parenthesize (var_)
Done.
> It might be nice to simplify it using an inline function.
Good idea. Done.
> (and maybe use the hdr/entry pattern too).
Done.
(In reply to comment #3)
> > It might be nice to simplify AppendRuleToTagTable as a followup.
>
> Simplify which part of it?
Having two functions where one would do? And perhaps also constructing the RuleValue slightly higher up in the call stack so that we really only increment mRuleCount once per rule added.
| Assignee | ||
Comment 5•16 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•16 years ago
|
Target Milestone: --- → mozilla1.9.3b2
You need to log in
before you can comment on or make changes to this bug.
Description
•