Bug 74284

Summary: Bloom filter has unnecesary collisions
Product: WebKit Reporter: Allan Sandfeld Jensen <allan.jensen>
Component: CSSAssignee: Allan Sandfeld Jensen <allan.jensen>
Status: RESOLVED FIXED    
Severity: Minor CC: kling, koivisto, macpherson, mjs, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Allan Sandfeld Jensen
Reported 2011-12-12 04:01:06 PST
The bloom filter used to optimize tag, id and class selectors on ancestor has a minor inefficiency in that the value those three different types all use the same hash value in the bloom-filter. This means that if a site uses a class or id-selector on something that is also a common tag name, it bloom-filter will produce unnecessary false positives and forcing the styler into slow path. My proposed solution is to add a salt to the hash so that the different selectors only collide by random chance, not because they use common words. This is an minor optimization only, not a functionality bug.
Attachments
Patch (4.28 KB, patch)
2011-12-12 04:02 PST, Allan Sandfeld Jensen
no flags
Allan Sandfeld Jensen
Comment 1 2011-12-12 04:02:20 PST
Antti Koivisto
Comment 2 2011-12-12 07:43:16 PST
Comment on attachment 118772 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=118772&action=review r=me, with a comment > Source/WebCore/css/SelectorChecker.cpp:85 > + identifierHashes.append(element->localName().impl()->existingHash() * TagNameSalt); It might consider adding an inline function for computing hash type from AtomicString.
Antti Koivisto
Comment 3 2011-12-12 09:15:52 PST
s/It/You/
WebKit Review Bot
Comment 4 2011-12-14 05:52:13 PST
Comment on attachment 118772 [details] Patch Clearing flags on attachment: 118772 Committed r102770: <http://trac.webkit.org/changeset/102770>
WebKit Review Bot
Comment 5 2011-12-14 05:52:18 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.