Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 2a2bff6e7028e22ab05443ee79f7c742c0db8eeb https://github.com/WebKit/WebKit/commit/2a2bff6e7028e22ab05443ee79f7c742c0db8eeb Author: Chris Dumez <cdu...@apple.com> Date: 2023-02-24 (Fri, 24 Feb 2023)
Changed paths: M Source/WTF/wtf/text/StringImpl.h M Source/WebCore/html/EmailInputType.cpp M Source/WebCore/html/TextFieldInputType.cpp M Source/WebCore/platform/network/CacheValidation.cpp Log Message: ----------- Optimize TextFieldInputType::sanitizeValue() https://bugs.webkit.org/show_bug.cgi?id=252919 Reviewed by Darin Adler. I noticed while looking at profiles that TextFieldInputType::sanitizeValue() calls String::removeCharacters(isHTMLLineBreak) and that isHTMLLineBreak wasn't getting inlined (despite being marked as inline). If we pass a lambda to String::removeCharacters() instead of a function name, the compiler seems to be able to inline isHTMLLineBreak just fine, resulting in better performance. Before: Sample Count, Samples %, Normalized CPU %, Symbol 28, 100.0%, 0.0%, WebCore::TextFieldInputType::sanitizeValue(WTF::String const&) const (in WebCore) 22, 78.6%, 0.0%, WebCore::TextFieldInputType::sanitizeValue(WTF::String const&) const (.cold.1) (in WebCore) 10, 35.7%, 0.0%, WTF::Ref<WTF::StringImpl, WTF::RawPtrTraits<WTF::StringImpl>> WTF::StringImpl::removeCharacters<bool (char16_t)>(bool const(&)(char16_t)) (in WebCore) 9, 32.1%, 0.0%, WebCore::isHTMLLineBreak(char16_t) (in WebCore) 3, 10.7%, 0.0%, WTF::Ref<WTF::StringImpl, WTF::RawPtrTraits<WTF::StringImpl>> WTF::StringImpl::removeCharacters<bool (char16_t)>(bool const(&)(char16_t)) (in WebCore) After: Sample Count, Samples %, Normalized CPU %, Symbol 7, 100.0%, 0.0%, com.apple.WebKit (65138) 7, 100.0%, 0.0%, WebCore::TextFieldInputType::sanitizeValue(WTF::String const&) const (in WebCore) * Source/WebCore/html/EmailInputType.cpp: (WebCore::EmailInputType::sanitizeValue const): * Source/WebCore/html/TextFieldInputType.cpp: (WebCore::TextFieldInputType::sanitizeValue const): Canonical link: https://commits.webkit.org/260824@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes