Bug 233647 - Add a fast path for empty string to setInnerHTML()
Summary: Add a fast path for empty string to setInnerHTML()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Alexey Shvayka
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-11-30 11:01 PST by Alexey Shvayka
Modified: 2021-12-02 07:22 PST (History)
10 users (show)

See Also:


Attachments
Patch (2.85 KB, patch)
2021-11-30 11:02 PST, Alexey Shvayka
no flags Details | Formatted Diff | Diff
Microbenchmark (792 bytes, text/html)
2021-11-30 11:03 PST, Alexey Shvayka
no flags Details
Patch (3.41 KB, patch)
2021-12-01 08:43 PST, Alexey Shvayka
no flags Details | Formatted Diff | Diff
Patch (7.05 KB, patch)
2021-12-01 11:26 PST, Alexey Shvayka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Shvayka 2021-11-30 11:01:15 PST
Add a fast path for empty string to setInnerHTML()
Comment 1 Alexey Shvayka 2021-11-30 11:02:49 PST
Created attachment 445444 [details]
Patch
Comment 2 Alexey Shvayka 2021-11-30 11:03:50 PST
Created attachment 445445 [details]
Microbenchmark

r286261: 393ms
patched: 110ms (3.6x faster)
Comment 3 Geoffrey Garen 2021-11-30 11:36:43 PST
Comment on attachment 445444 [details]
Patch

r=me

Nice!
Comment 4 Alexey Shvayka 2021-12-01 08:43:40 PST
Created attachment 445578 [details]
Patch

Special-case <html> container.
Comment 5 Yusuke Suzuki 2021-12-01 09:53:16 PST
NICE! Can we add a test for this HTMLElement thing?
Comment 6 Alexey Shvayka 2021-12-01 09:56:44 PST
(In reply to Yusuke Suzuki from comment #5)
> NICE! Can we add a test for this HTMLElement thing?

Thanks! You mean for the <html> thing? imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_innerHTML_tests_innerHTML_1.html captures that.
Comment 7 Yusuke Suzuki 2021-12-01 10:04:18 PST
(In reply to Alexey Shvayka from comment #6)
> (In reply to Yusuke Suzuki from comment #5)
> > NICE! Can we add a test for this HTMLElement thing?
> 
> Thanks! You mean for the <html> thing?
> imported/w3c/web-platform-tests/html/syntax/parsing/
> html5lib_innerHTML_tests_innerHTML_1.html captures that.

Perfect!
Comment 8 Alexey Shvayka 2021-12-01 11:26:25 PST
Created attachment 445596 [details]
Patch

Fix <template> contents case and add a test.
Comment 9 EWS Watchlist 2021-12-01 11:27:13 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 10 Alexey Shvayka 2021-12-02 06:42:35 PST
Comment on attachment 445596 [details]
Patch

Setting r+ on my own patch, which is already reviewed by Geoff, to make GitHub WPT export bot happy.
Comment 11 EWS 2021-12-02 07:21:22 PST
Committed r286425 (244771@main): <https://commits.webkit.org/244771@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 445596 [details].
Comment 12 Radar WebKit Bug Importer 2021-12-02 07:22:23 PST
<rdar://problem/85970175>