Bug 239545

Summary: Avoid call to convertToASCIILowercase() in SelectorFilter::collectElementIdentifierHashes() in the common case
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, darin, esprehn+autocc, ews-watchlist, ggaren, glenn, gyuyoung.kim, macpherson, menard, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Chris Dumez
Reported 2022-04-20 09:08:45 PDT
Avoid call to convertToASCIILowercase() in SelectorFilter::collectElementIdentifierHashes() in the common case.
Attachments
Patch (2.24 KB, patch)
2022-04-20 09:12 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2022-04-20 09:12:51 PDT
Sam Weinig
Comment 2 2022-04-20 14:42:49 PDT
Comment on attachment 457993 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457993&action=review > Source/WebCore/css/SelectorFilter.cpp:50 > + AtomString tagLowercaseLocalName = LIKELY(element.isHTMLElement() && !element.isUnknownElement()) ? element.localName() : element.localName().convertToASCIILowercase(); A comment explaining this assumption would be useful even with the assert.
EWS
Comment 3 2022-04-20 15:12:34 PDT
Committed r293123 (249826@main): <https://commits.webkit.org/249826@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 457993 [details].
Radar WebKit Bug Importer
Comment 4 2022-04-20 15:13:29 PDT
Darin Adler
Comment 5 2022-04-20 17:44:46 PDT
Comment on attachment 457993 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457993&action=review >> Source/WebCore/css/SelectorFilter.cpp:50 >> + AtomString tagLowercaseLocalName = LIKELY(element.isHTMLElement() && !element.isUnknownElement()) ? element.localName() : element.localName().convertToASCIILowercase(); > > A comment explaining this assumption would be useful even with the assert. The classic way to do this is to write a function named localNameIsKnownToBeLowercase or localNameMayContainUppercaseASCII. Then that function is the perfect place for the comment explaining why the rule is correct, and here the code is more obviously correct.
Chris Dumez
Comment 6 2022-04-20 18:10:49 PDT
(In reply to Darin Adler from comment #5) > Comment on attachment 457993 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=457993&action=review > > >> Source/WebCore/css/SelectorFilter.cpp:50 > >> + AtomString tagLowercaseLocalName = LIKELY(element.isHTMLElement() && !element.isUnknownElement()) ? element.localName() : element.localName().convertToASCIILowercase(); > > > > A comment explaining this assumption would be useful even with the assert. > > The classic way to do this is to write a function named > localNameIsKnownToBeLowercase or localNameMayContainUppercaseASCII. Then > that function is the perfect place for the comment explaining why the rule > is correct, and here the code is more obviously correct. Oh, I missed Sam's comment before landing. Sorry about that. I'll follow-up.
Chris Dumez
Comment 7 2022-04-20 18:52:27 PDT
0.38% progression on Speedometer on Intel, neutral on Apple Silicon.
Chris Dumez
Comment 8 2022-04-20 19:08:43 PDT
(In reply to Darin Adler from comment #5) > Comment on attachment 457993 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=457993&action=review > > >> Source/WebCore/css/SelectorFilter.cpp:50 > >> + AtomString tagLowercaseLocalName = LIKELY(element.isHTMLElement() && !element.isUnknownElement()) ? element.localName() : element.localName().convertToASCIILowercase(); > > > > A comment explaining this assumption would be useful even with the assert. > > The classic way to do this is to write a function named > localNameIsKnownToBeLowercase or localNameMayContainUppercaseASCII. Then > that function is the perfect place for the comment explaining why the rule > is correct, and here the code is more obviously correct. Done in <https://commits.webkit.org/r293138>.
Note You need to log in before you can comment on or make changes to this bug.