[webkit-changes] [WebKit/WebKit] 2e3b73: [JSC] Implement `Array.prototype.toSorted` in C++

SUZUKI Sosuke noreply at github.com
Thu Dec 12 04:09:56 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2e3b7325657e70052d111fbf53a3bd4e07a484df
      https://github.com/WebKit/WebKit/commit/2e3b7325657e70052d111fbf53a3bd4e07a484df
  Author: Sosuke Suzuki <aosukeke at gmail.com>
  Date:   2024-12-12 (Thu, 12 Dec 2024)

  Changed paths:
    A JSTests/microbenchmarks/array-prototype-toSorted-large-array-comparator-double.js
    M Source/JavaScriptCore/builtins/ArrayPrototype.js
    M Source/JavaScriptCore/builtins/BuiltinNames.h
    M Source/JavaScriptCore/bytecode/LinkTimeConstant.h
    M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
    M Source/JavaScriptCore/runtime/CommonIdentifiers.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp

  Log Message:
  -----------
  [JSC] Implement `Array.prototype.toSorted` in C++
https://bugs.webkit.org/show_bug.cgi?id=284445

Reviewed by Yusuke Suzuki.

In current implementation, `Array#toSorted` is written in JavaScript.
This patch implements it in C++.

In BaselineJIT, this patch makes it 1.2x faster. Also no performance
regression by this patch.

With DFG/FTL:

                                                      TipOfTree                  Patched

    array-prototype-toSorted-large-array-comparator-double
                                                   11.6039+-0.1263     ^     11.0654+-0.2067        ^ definitely 1.0487x faster

    <geometric>                                    11.6039+-0.1263     ^     11.0654+-0.2067        ^ definitely 1.0487x faster

Without DFG/FTL:

                                                      TipOfTree                  Patched

    array-prototype-toSorted-large-array-comparator-double
                                                   14.3067+-0.1834     ^     11.7961+-0.1853        ^ definitely 1.2128x faster

    <geometric>                                    14.3067+-0.1834     ^     11.7961+-0.1853        ^ definitely 1.2128x faster

* JSTests/microbenchmarks/array-prototype-toSorted-large-array-comparator-double.js: Added.
* Source/JavaScriptCore/builtins/ArrayPrototype.js:
(toSorted): Deleted.
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):
(JSC::sortImpl):
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/CommonIdentifiers.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list