[Webkit-unassigned] [Bug 283118] New: for-of loops noticeably slower than alternatives, including map
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Nov 14 09:07:29 PST 2024
https://bugs.webkit.org/show_bug.cgi?id=283118
Bug ID: 283118
Summary: for-of loops noticeably slower than alternatives,
including map
Product: WebKit
Version: Safari 18
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: rik at webkit.org
Created attachment 473227
--> https://bugs.webkit.org/attachment.cgi?id=473227&action=review
Results in Safari, Firefox and Chrome
On the linked benchmark, a simple for-of loop performs noticeably worse than a forEach loop or a classic for loop.
It even performs worse than the equivalent map transformation which I find surprising because map has to do extra work (destructure the array, create a new one and replace it in the existing array).
Firefox and Chrome results are roughly what I would expect: map is the slowest, classic loop is the fastest, forEach and for-of are in between.
--
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/20241114/4818439f/attachment.htm>
More information about the webkit-unassigned
mailing list