[Webkit-unassigned] [Bug 271735] New: URL.searchParams performance issue
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Mar 26 16:10:52 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=271735
Bug ID: 271735
Summary: URL.searchParams performance issue
Product: WebKit
Version: Safari 17
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebCore JavaScript
Assignee: webkit-unassigned at lists.webkit.org
Reporter: me at mattcowley.co.uk
It seems that WebKit suffers from the same performance issue that I fixed in Node.js (https://github.com/nodejs/node/pull/51520), where repeat writes to `URL.searchParams` trigger `URL` to re-parse the params on every write, leading to a performance bottleneck.
```js
// Will lock up the browser
const params = new URL('https://mozilla.org').searchParams;
for (let i = 0; i < 100_000; i++) params.append('test', i.toString());
```
```js
// Will run without issue
const params = new URLSearchParams();
for (let i = 0; i < 100_000; i++) params.append('test', i.toString());
```
I suspect a patch similar to what I landed in Node.js, where URL is lazily updated if searchParams has changed the next time a getter is called, rather than immediately updating URL when searchParams changes, would fix it.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240326/e97c34aa/attachment.htm>
More information about the webkit-unassigned
mailing list