Bug 247739 - Setting the value of a textarea is much slower in WebKit than it is in Chromium
Summary: Setting the value of a textarea is much slower in WebKit than it is in Chromium
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-10 09:05 PST by Ahmad Saleem
Modified: 2022-11-11 17:09 PST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2022-11-10 09:05:08 PST
Hi Team,

I cam across one potential performance optimization in Blink, which can be used in Webkit but unfortunately, it does not have any testcase to confirm.

Blink Commit - https://chromium.googlesource.com/chromium/blink/+/c70fbd89e637c6fbd7bfeb17e6f5b2ff2dae6f16

Webkit GitHub Source - https://github.com/WebKit/WebKit/blob/7cbae1c1f4b5ae8a346085fb9e543746d39c9bd8/Source/WTF/wtf/text/WTFString.h#LL166

and

https://github.com/WebKit/WebKit/blob/7cbae1c1f4b5ae8a346085fb9e543746d39c9bd8/Source/WTF/wtf/text/WTFString.h#L145

I can do PR but I don't have any testcase etc. to confirm whether it is good change for Webkit or not. Hence, I am hesitant and would add others to confirm whether we should this change or not.

Thanks!
Comment 1 Ahmad Saleem 2022-11-10 09:09:33 PST
JSFiddle - https://jsfiddle.net/gxpajusr/1/

Benchmark (textarea-dom.html) mentioned by Blink commit, which improved the performance.
Comment 2 Alexey Proskuryakov 2022-11-10 09:16:39 PST
Chrome is substantially faster on this microbenchmark - and became ~2x faster since this 2015 commit.
Comment 3 Darin Adler 2022-11-10 09:40:18 PST
I’ll take a look at the microbenchmark. I think I have a different idea how to speed it up, but I may end up doing the same thing they did in Chromium.
Comment 4 Radar WebKit Bug Importer 2022-11-10 16:35:23 PST
<rdar://problem/102218029>
Comment 5 Darin Adler 2022-11-10 17:47:24 PST
String::contains is already quite well optimized. We would save almost nothing by specializing it for 8-bit character input. However, the makeStringBySimplifyingNewLines function can be made much more efficient.
Comment 6 Darin Adler 2022-11-11 14:13:55 PST
Pull request: https://github.com/WebKit/WebKit/pull/6411
Comment 7 EWS 2022-11-11 17:09:38 PST
Committed 256596@main (610bbdbf42f2): <https://commits.webkit.org/256596@main>

Reviewed commits have been landed. Closing PR #6411 and removing active labels.