Bug 154674 - Consider using a jump table in element factories
Summary: Consider using a jump table in element factories
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-25 03:22 PST by Ryosuke Niwa
Modified: 2018-03-23 20:28 PDT (History)
12 users (show)

See Also:


Attachments
WIP (13.08 KB, patch)
2016-02-25 03:22 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
WIP (16.01 KB, patch)
2016-02-25 19:35 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
WIP2 (33.90 KB, patch)
2018-03-22 23:55 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
WIP3 (37.62 KB, patch)
2018-03-23 01:26 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
WIP4 (fixed build) (35.32 KB, patch)
2018-03-23 14:57 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2016-02-25 03:22:34 PST
Created attachment 272199 [details]
WIP

We've always said that it's silly to be using HashMap for looking up the atomic string name.

Here's a super crude prototype of using alphabet jump table & one-level binary search.

This appears to be ~0.5% improvement on PerformanceTests/Bindings/create-element.html but this test only creates div so we need a more comprehensive testing.
Comment 1 Ryosuke Niwa 2016-02-25 19:35:14 PST
Created attachment 272281 [details]
WIP

Here's a new WIP patch with tests.

I was observing a consistent 1-2% gain but I'm no longer seeing that now :(
I don't know whether my testing was busted.
I'm somehow seeing a lot more variance on my test results now.
Comment 2 Ryosuke Niwa 2018-03-22 23:55:41 PDT
Created attachment 336357 [details]
WIP2
Comment 3 Ryosuke Niwa 2018-03-23 01:26:12 PDT
Created attachment 336359 [details]
WIP3

With this patch, we avoid creating AtomicString when creating built-in HTML elements in the HTML parser & createElement. In the case of createElement, we also avoid lowercasing the string.
Comment 4 EWS Watchlist 2018-03-23 01:28:05 PDT
Attachment 336359 [details] did not pass style-queue:


ERROR: Source/WebCore/dom/TagNameLookupTable.h:26:  Use #pragma once instead of #ifndef for header guard.  [build/header_guard] [5]
ERROR: Source/WebCore/dom/TagNameLookupTable.cpp:29:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/parser/AtomicHTMLToken.h:30:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 3 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Ryosuke Niwa 2018-03-23 14:57:55 PDT
Created attachment 336429 [details]
WIP4 (fixed build)
Comment 6 Ryosuke Niwa 2018-03-23 20:28:20 PDT
Hm... this appears to be an overall regression in Speedometer because there are enough non-standard attributes set. I guess we won't do this.