WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
60708
make :any work with fastRejectSelector
https://bugs.webkit.org/show_bug.cgi?id=60708
Summary
make :any work with fastRejectSelector
Ojan Vafai
Reported
2011-05-12 10:45:12 PDT
make :any work with fastRejectSelector
Attachments
Patch
(1.77 MB, patch)
2011-05-12 15:14 PDT
,
Ojan Vafai
no flags
Details
Formatted Diff
Diff
Patch
(63.37 KB, patch)
2011-06-22 15:25 PDT
,
Ojan Vafai
no flags
Details
Formatted Diff
Diff
Patch
(63.55 KB, patch)
2011-06-22 15:34 PDT
,
Ojan Vafai
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Ojan Vafai
Comment 1
2011-05-12 15:14:58 PDT
Created
attachment 93354
[details]
Patch
Ojan Vafai
Comment 2
2011-05-12 15:19:55 PDT
Sorry about the huge patch. The code changes themselves are reasonably sized, but the two manual test cases are each 16k lines. I'm happy to move those into a separate patch if you'd like. I'm a bit unhappy with the memory management in this patch. See the section in WebCore ChangeLog under deleteRareHashes. I tried working around it by doing something with VectorTraits to use memcpy, but that didn't address the case where a RuleData was created on the stack. I would love ideas on how to better handle this.
Antti Koivisto
Comment 3
2011-05-16 07:32:38 PDT
I don't like this. The ancestor identifier filter specifically aims to speed up the common cases. Adding special handling for a rare case sort of misses the point. This adds a branchiness to fastRejectSelector which is almost certainly enough to regress it (it currently inlines into a very tight loop). One approach for optimizing :any might be to split them up into multiple RuleData entries, each with unique descendantSelectorIdentifierHashes but referencing the same RuleSet. This wouldn't work for multilevel :any (due to exponential growth) but simply optimizing one level would cover most realistic cases. The performance test files are huge. Wouldn't it be possible to generate the test stylesheet programmatically?
Antti Koivisto
Comment 4
2011-05-16 07:35:05 PDT
Comment on
attachment 93354
[details]
Patch r- based on comments above. At minimum there would need to be some convincing profiles showing that this does not regress the common case.
Ojan Vafai
Comment 5
2011-05-18 12:32:00 PDT
(In reply to
comment #3
)
> One approach for optimizing :any might be to split them up into multiple RuleData entries, each with unique descendantSelectorIdentifierHashes but referencing the same RuleSet. This wouldn't work for multilevel :any (due to exponential growth) but simply optimizing one level would cover most realistic cases.
I like this much better. It's slightly less memory friendly, but I think it likely will simplify code and be more performant. This also should naturally fix
bug 56991
. For now, the spec (and our code) disallows nested :any, so we don't need to handle that case. It does take away some of the potential performance benefits of using :any though, in that we we now need to selector match each RuleData instead of one. I think I'm OK with that given the code simplicity of this approach.
> The performance test files are huge. Wouldn't it be possible to generate the test stylesheet programmatically?
Yeah, sorry. Will fix.
Ojan Vafai
Comment 6
2011-05-18 15:15:30 PDT
Just want to make sure I understand what you're proposing. For each RuleData that we create for a :any case, we'd need to create a new CSSSelector to stick in it, right? For example, for "div :any(h1, h2)" we'd create two RuleData objects and stick a new CSSSelector in each on ("div h1" and "div h2"). This would mean that each time we go to add a RuleData to a RuleSet, we would need to iterate over the CSSSelectors in the selector to make sure none of them are :any. If one of them is :any, then we need to iterate over can construct new CSSSelectors as we go. This all seems fine to me, just wanted to run it by you.
Antti Koivisto
Comment 7
2011-05-19 06:29:49 PDT
Basically you would have multiple RuleData objects that reference the same CSSStyleRule and CSSSelector and differ by m_descendantSelectorIdentifierHashes only. The only complication I see is that you don't want the same rule be applied multiple times (because css counters and similar might get confused). That should be easy and fast to filter at the end. The copied rules will have identical specificity/position and sortMatchedRules() will sort them next to each other.
Antti Koivisto
Comment 8
2011-05-19 06:48:59 PDT
If :any is the topmost selector, their RuleData entries may actually be identical (but live as separate entires in RuleSet hashes that classify based on the topmost selector).
Ojan Vafai
Comment 9
2011-06-22 15:25:58 PDT
Created
attachment 98250
[details]
Patch
WebKit Review Bot
Comment 10
2011-06-22 15:28:05 PDT
Attachment 98250
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 Source/WebCore/css/CSSStyleSelector.cpp:3184: A case label should not be indented, but line up with its switch statement. [whitespace/indent] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ojan Vafai
Comment 11
2011-06-22 15:34:49 PDT
Created
attachment 98253
[details]
Patch
WebKit Review Bot
Comment 12
2011-06-22 15:39:09 PDT
Attachment 98253
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 Source/WebCore/css/CSSStyleSelector.cpp:3186: A case label should not be indented, but line up with its switch statement. [whitespace/indent] [4] Total errors found: 1 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ojan Vafai
Comment 13
2012-02-22 11:43:09 PST
Comment on
attachment 98253
[details]
Patch This patch almost certainly doesn't apply cleanly to trunk anymore. Removing the r? for now.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug