Open
Bug 1027978
Opened 10 years ago
Updated 7 months ago
consider using bloom filter in querySelectorAll()
Categories
(Core :: DOM: Core & HTML, defect, P3)
Core
DOM: Core & HTML
Tracking
()
NEW
People
(Reporter: bkelly, Unassigned)
References
Details
Attachments
(1 file)
14.62 KB,
text/html
|
Details |
On twitter we had an interesting conversation with Brian Kardell. He was asking if a bloom filter was used for querySelectorAll().
Boris indicated that while we use bloom filters in other places for CSS selectors, we don't currently use it for querySelectAll(). At the time it was implemented it was a net-negative in terms of performance.
However, Boris also suggests that the situation could have changed. For example, we now have a selector cache in querySelectorAll().
He also mentioned that we need to be careful about measuring micro-benchmarks vs. real-world workloads.
Full twitter conversation is here:
https://twitter.com/briankardell/status/479721371165929472
Reporter | ||
Comment 1•10 years ago
|
||
Spam Boris's request queue as requested. :-)
Flags: needinfo?(bzbarsky)
Comment 2•10 years ago
|
||
Some notes to self:
1) Chrome (but not Safari) has some sort of optimization where if there is only one selector in the selector list and that selector has a descendant combinator where the LHS is an id selector then they do some sort of fast path. That might be worth looking into, but is somewhat independent of this bug.
2) We'd need to associate a hash with each selector in the selector list. Probably want to factor out the code in RuleValue::CollectAncestorHashes. An initial investigation can probably just recompute this on each qSA call, but long-term we want to cache it like we do the parsed selectors.
3) Need to maintain the ancestor push/pop stuff as we walk over the tree.
4) Need to check the filter; probably need to pass the hashes into nsCSSRuleProcessor::SelectorListMatches.
Comment 3•10 years ago
|
||
Another note to self: The steps in bug 1023445 might be interesting to measure.
Comment 4•7 years ago
|
||
Emilio will basically deal with this once he enable's stylo's code here.
Flags: needinfo?(bzbarsky)
Updated•6 years ago
|
Priority: -- → P3
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Comment 5•5 years ago
|
||
Emilio, you fixed this in stylo, right?
Assignee: bzbarsky → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(emilio)
Comment 6•5 years ago
|
||
Kinda. We have optimizations for the kind of thing we use the bloom filter code like having ancestor selectors with class names and such.
We also have a code path where we match right-to-left, but I never managed to make it fast enough so right now it's not enabled.
So the situation is better but a bloom filter would probably still need measuring and could still be useful for the case we have multiple selectors and such.
Flags: needinfo?(emilio)
Updated•2 years ago
|
Severity: normal → S3
Comment 7•7 months ago
|
||
Nightly: 481000
Chrome: 5000
You need to log in
before you can comment on or make changes to this bug.
Description
•