Repository navigation
Conversation
…ests oven-sh/WebKit#553 (merged as e9b43fbb). Since the WebKit bump in #41083, JSC started its MarkedBlock warm-up thread on the first block a process allocated, and mimalloc's scavenger thread started behind it. Bringing up a VM takes about 30 blocks. So every `bun -e` and every short script created two threads that did no useful work, and faulted in a supply of blocks it never used. The thread now starts after 64 block requests (the new warmUpMarkedBlockStartAfterBlocks option). A script that keeps allocating passes that within its first milliseconds, and still gets the helper, which makes such a script about 19% faster. The test starts a script that waits on stdin, as `bun -e` and as a file, and reads its thread names from /proc. It fails on 491b5cc2.
|
Warning Review limit reached
On-demand reviews are free for the next 18 days. After that, they cost $0.25 per reviewed file. Or wait 33 minutes for your next included review. View limit detailsLimit details: You’ve used all 10 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (2)
Comment |
There was a problem hiding this comment.
I reviewed this PR and didn't find any bugs. The Bun-side diff is a clean one-line pin bump plus a well-constructed regression test, but since the actual behavioral change lives in the WebKit fork and touches JSC's GC block-allocation threading, a human should confirm the oven-sh/WebKit#553 change and that the e9b43fbb prebuilt release has all platform assets before merge.
What was reviewed:
- The pin bump follows the
scripts/build/depsconvention; grepped the repo for the old hash491b5cc2— no other occurrences. - The new test awaits the child's "ready" line before reading
/proc/<pid>/task/*/comm(no sleep-polling), drains stderr, asserts output before exit code, usestempDir/bunEnv/await using, and gates onisLinux. - Checked pipe-read framing:
console.log("ready")is a single sub-PIPE_BUF write, soreader.read()returning the full line is safe on Linux.
Extended reasoning...
Overview
This PR changes two files: scripts/build/deps/webkit.ts bumps the pinned WebKit prebuilt from 491b5cc2… to e9b43fbb…, and test/cli/run/run-eval.test.ts adds a Linux-only test asserting that a low-allocation script (run via -e and via a file) does not spawn JSC's JSCWarmUp MarkedBlock warm-up thread. The substantive change — deferring the warm-up thread until 64 block requests instead of the first — lives in oven-sh/WebKit#553, not in this diff.
Security risks
None identified. There is no new attack surface: the WebKit bump changes an internal GC-helper-thread start threshold, and the test only reads /proc/<pid>/task/*/comm for a child it spawned. No untrusted input parsing, no auth/crypto/network paths touched.
Level of scrutiny
High, because WebKit is the JavaScript engine — the single most critical dependency in the project — and the behavioral change concerns GC block allocation and threading. The Bun-side diff is trivial and correct, but the reviewable substance is in the external WebKit commit. Per the repo's dependencies-and-vendoring guidance, a WebKit pin bump requires verifying that prebuilt artifacts exist for every platform × flavor; the PR description claims 42 matching assets but that is not verifiable from this diff alone. The author also notes they did not build locally with the new pin, so CI and a human sign-off carry the full verification burden.
Other factors
The test is well-constructed against the repo's review rules: it extends the existing run-eval.test.ts rather than creating a new file, uses tempDir/bunExe/bunEnv/await using, awaits the observable "ready" stdout line rather than sleeping, drains stderr concurrently with proc.exited, asserts stderr/stdout before exit code, and covers both the -e and file entry points concurrently. I confirmed the old hash 491b5cc2 appears nowhere else in the repo. No CODEOWNERS pattern covers either changed file. The PR is otherwise self-contained and narrowly scoped, so the only reason to defer is the criticality of the dependency itself.
Problem
bun -eor short script creates two idle threads and faults in unused blocks.Fix
warmUpMarkedBlockStartAfterBlocks).test/cli/run/run-eval.test.ts. A script that waits on stdin, run as-eand as a file, must have noJSCWarmUpthread. It fails on the current canary and passes there withBUN_JSC_useWarmUpMarkedBlocks=false. CI runs it on the new pin.Current canary (release x64 Linux), as it is and with the warm-up thread off, which is what this pin does for these scripts. Interleaved, 400 rounds, median:
bun -e 1bun empty.jsBackground
Notes
bun -e 1makes 28. The test's script makes 27 as-eand 26 as a file. A script that loadsnode:fsand lists its threads makes 49.-e 1). That is the two threads' work.491b5cc2appears nowhere else in the repo.