[webkit-changes] [WebKit/WebKit] d4018f: [JSC] Implement Uint8Array.prototype.toHex in SIMD

Yusuke Suzuki noreply at github.com
Sun Jul 7 10:28:21 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d4018f63175c602605145887c61d21ffdbd1a75b
      https://github.com/WebKit/WebKit/commit/d4018f63175c602605145887c61d21ffdbd1a75b
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-07-07 (Sun, 07 Jul 2024)

  Changed paths:
    A JSTests/microbenchmarks/to-hex.js
    M JSTests/stress/uint8array-toHex.js
    M Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototype.cpp

  Log Message:
  -----------
  [JSC] Implement Uint8Array.prototype.toHex in SIMD
https://bugs.webkit.org/show_bug.cgi?id=276295
rdar://problem/131249821

Reviewed by Sam Weinig.

toHex function is very simple conversion, thus we can write it in SIMD easily.
In particular, we leverage vqtbl1q_u8 since hex characters are only 16 characters, which fits in vqtbl1q_u8's table.
The newly written code is 19x faster than the scalar one.

                               ToT                     Patched

    to-hex              259.5243+-0.8852     ^     13.2425+-0.1322        ^ definitely 19.5979x faster

* JSTests/microbenchmarks/to-hex.js: Added.
* JSTests/stress/uint8array-toHex.js:
(255.toHex):
(shouldBe):
* Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/280719@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