Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 59d83df397a34126663e75a955bb5de8813500e0
https://github.com/WebKit/WebKit/commit/59d83df397a34126663e75a955bb5de8813500e0
Author: Sosuke Suzuki <[email protected]>
Date: 2026-03-29 (Sun, 29 Mar 2026)
Changed paths:
M Source/JavaScriptCore/offlineasm/arm64e.rb
M Source/JavaScriptCore/offlineasm/risc.rb
M Source/JavaScriptCore/offlineasm/transform.rb
Log Message:
-----------
[JSC] Fix O(n^2) list building in offlineasm
https://bugs.webkit.org/show_bug.cgi?id=310979
Reviewed by Yusuke Suzuki.
Ruby's `a += b` is sugar for `a = a + b`, which allocates a new array
and copies every element even when b is empty. Several lowering passes
append to a growing instruction list this way inside a loop, making them
O(n^2) in the list length. riscLowerMisplacedAddresses is the worst
offender, iterating ~49,000 times per configuration.
Switching to Array#concat (in-place append) brings LLIntAssembly.h
generation from 5.85s down to 4.31s on Apple Silicon with the macOS
system Ruby. Output is byte-identical.
* Source/JavaScriptCore/offlineasm/arm64e.rb:
* Source/JavaScriptCore/offlineasm/risc.rb:
* Source/JavaScriptCore/offlineasm/transform.rb:
Canonical link: https://commits.webkit.org/310180@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications