Title: [289691] trunk/Source/WebCore
- Revision
- 289691
- Author
- [email protected]
- Date
- 2022-02-12 07:08:16 -0800 (Sat, 12 Feb 2022)
Log Message
Look up InputTypeFactoryMap with an ASCII lowercase string instead of using a ASCIICaseInsensitiveHash
https://bugs.webkit.org/show_bug.cgi?id=236532
Reviewed by Myles C. Maxfield.
InputType::create looks up the InputTypeFactoryMap based on the
AtomString value of the <input type> attribute. The HashMap uses an
ASCIICaseInsensitiveHash, but the AtomStrings stored in the map are all
ASCII lowercase to begin with. This means that we spend time doing an
ASCII case insensitive hash computation on the query string. Most
content already supplies an ASCII lowercase type value, so it's less
work to ASCII lowercase the type value and then look up the HashMap
using the regular hash for AtomStrings (i.e., pulling the hash out of
AtomString).
Doing this is a 0.5% improvement on a couple of Speedometer 2 subtests,
and a 0.1% improvement to the overall score.
* html/InputType.cpp:
(WebCore::InputType::create):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (289690 => 289691)
--- trunk/Source/WebCore/ChangeLog 2022-02-12 14:20:42 UTC (rev 289690)
+++ trunk/Source/WebCore/ChangeLog 2022-02-12 15:08:16 UTC (rev 289691)
@@ -1,3 +1,26 @@
+2022-02-12 Cameron McCormack <[email protected]>
+
+ Look up InputTypeFactoryMap with an ASCII lowercase string instead of using a ASCIICaseInsensitiveHash
+ https://bugs.webkit.org/show_bug.cgi?id=236532
+
+ Reviewed by Myles C. Maxfield.
+
+ InputType::create looks up the InputTypeFactoryMap based on the
+ AtomString value of the <input type> attribute. The HashMap uses an
+ ASCIICaseInsensitiveHash, but the AtomStrings stored in the map are all
+ ASCII lowercase to begin with. This means that we spend time doing an
+ ASCII case insensitive hash computation on the query string. Most
+ content already supplies an ASCII lowercase type value, so it's less
+ work to ASCII lowercase the type value and then look up the HashMap
+ using the regular hash for AtomStrings (i.e., pulling the hash out of
+ AtomString).
+
+ Doing this is a 0.5% improvement on a couple of Speedometer 2 subtests,
+ and a 0.1% improvement to the overall score.
+
+ * html/InputType.cpp:
+ (WebCore::InputType::create):
+
2022-02-11 Alan Bujtas <[email protected]>
`contain:content` breaks fullscreen
Modified: trunk/Source/WebCore/html/InputType.cpp (289690 => 289691)
--- trunk/Source/WebCore/html/InputType.cpp 2022-02-12 14:20:42 UTC (rev 289690)
+++ trunk/Source/WebCore/html/InputType.cpp 2022-02-12 15:08:16 UTC (rev 289691)
@@ -90,7 +90,7 @@
typedef bool (Settings::*InputTypeConditionalFunction)() const;
typedef const AtomString& (*InputTypeNameFunction)();
typedef Ref<InputType> (*InputTypeFactoryFunction)(HTMLInputElement&);
-typedef HashMap<AtomString, std::pair<InputTypeConditionalFunction, InputTypeFactoryFunction>, ASCIICaseInsensitiveHash> InputTypeFactoryMap;
+typedef HashMap<AtomString, std::pair<InputTypeConditionalFunction, InputTypeFactoryFunction>> InputTypeFactoryMap;
template<class T> static Ref<InputType> createInputType(HTMLInputElement& element)
{
@@ -150,7 +150,7 @@
{
if (!typeName.isEmpty()) {
static NeverDestroyed factoryMap = createInputTypeFactoryMap();
- auto&& [conditional, factory] = factoryMap.get().get(typeName);
+ auto&& [conditional, factory] = factoryMap.get().get(typeName.convertToASCIILowercase());
if (factory && (!conditional || std::invoke(conditional, element.document().settings())))
return factory(element);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes