WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 280600
280144
Deleting existing entry from Map/Set followed by re-adding is 30x slower than in v8
https://bugs.webkit.org/show_bug.cgi?id=280144
Summary
Deleting existing entry from Map/Set followed by re-adding is 30x slower than...
Dylan Conway
Reported
2024-09-21 22:43:12 PDT
Example minified from
https://github.com/oven-sh/bun/issues/14063
``` var map = new Set(); for (var i = 0; i < 1000; i++) { for (var j = 0; j < 1000; j++) { map.delete(j); map.add(j); } } ``` Running this on an m1 max takes about 1 second with JSC. With v8 it takes about 100 milliseconds. Switching the order of `delete` and `add`, or combining the loops into a single loop to 1000000 does not seem to repro this behavior.
Attachments
Add attachment
proposed patch, testcase, etc.
Dylan Conway
Comment 1
2024-09-25 01:07:48 PDT
I suspect this is a bug causing the table to resize too frequently. Removing `shrinkIfNeeded` in `OrderedHashTableHelper::removeImpl` almost brings performance back to normal
Radar WebKit Bug Importer
Comment 2
2024-09-28 22:44:18 PDT
<
rdar://problem/136912759
>
Yusuke Suzuki
Comment 3
2024-09-29 22:42:19 PDT
Thanks. Oops, I accidentally opened a new bugzilla for patch upload. Merging it to that as it already has GitHub link. *** This bug has been marked as a duplicate of
bug 280600
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug