Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5dcc399282a60b9241b2cf3054ffcad6b5ac825b
      
https://github.com/WebKit/WebKit/commit/5dcc399282a60b9241b2cf3054ffcad6b5ac825b
  Author: Sosuke Suzuki <sos...@bun.sh>
  Date:   2025-08-30 (Sat, 30 Aug 2025)

  Changed paths:
    A JSTests/microbenchmarks/iterator-prototype-forEach-set.js
    A JSTests/microbenchmarks/iterator-prototype-toArray-set.js
    A JSTests/stress/aggregate-error-constructor-broken-set.js
    A JSTests/stress/iterator-prototype-forEach-set.js
    A JSTests/stress/iterator-prototype-toArray-broken-set-iterator.js
    A JSTests/stress/iterator-prototype-toArray-set.js
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/runtime/IteratorOperations.h
    M Source/JavaScriptCore/runtime/JSSet.h
    M Source/JavaScriptCore/runtime/SetIteratorPrototype.h
    M Source/JavaScriptCore/runtime/SetIteratorPrototypeInlines.h

  Log Message:
  -----------
  [JSC] Add fast path for iteration on Set
https://bugs.webkit.org/show_bug.cgi?id=297952

Reviewed by Yusuke Suzuki.

This patch adds a fast path for Set (and SetIterator) to 
`forEachInIteratorProtocol`
and `forEachInIterable`. These functions are used in 
`Iterator.prototype.toArray`,
`Iterator.prototype.forEach`, and constructors like `AggregateError` and more.

This makes iteration over Sets about 5x faster.

                                        TipOfTree                  Patched

iterator-prototype-toArray-set        4.8285+-0.1564     ^      0.9608+-0.0151  
      ^ definitely 5.0257x faster
iterator-prototype-forEach-set        4.7728+-0.1237     ^      0.9953+-0.0693  
      ^ definitely 4.7954x faster

* JSTests/microbenchmarks/iterator-prototype-forEach-set.js: Added.
(test):
(set add):
(const.set new):
* JSTests/microbenchmarks/iterator-prototype-toArray-set.js: Added.
(test):
* JSTests/stress/aggregate-error-constructor-broken-set.js: Added.
(set shouldBe):
(set Symbol):
(const.set new):
* JSTests/stress/iterator-prototype-forEach-set.js: Added.
(test):
(shouldBe):
(throw.new.Error.const.set new):
* JSTests/stress/iterator-prototype-toArray-broken-set-iterator.js: Added.
(test):
(shouldBe):
(throw.new.Error.const.setIterator.set values):
(const.set new):
* JSTests/stress/iterator-prototype-toArray-set.js: Added.
(test):
(shouldBe):
* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/runtime/IteratorOperations.h:
(JSC::forEachInSetStorage):
(JSC::forEachInIterable):
(JSC::forEachInIteratorProtocol):
* Source/JavaScriptCore/runtime/JSSet.h:
* Source/JavaScriptCore/runtime/SetIteratorPrototype.h:
* Source/JavaScriptCore/runtime/SetIteratorPrototypeInlines.h:
(JSC::setIteratorProtocolIsFastAndNonObservable):

Canonical link: https://commits.webkit.org/299358@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to