[Performance] Make in-guest Homebrew queries practical - #1222
Open
brandonpayton wants to merge 3 commits into
Open
[Performance] Make in-guest Homebrew queries practical#1222brandonpayton wants to merge 3 commits into
brandonpayton wants to merge 3 commits into
Conversation
Run Homebrew through a relocatable portable Ruby layout with its real Bootsnap and msgpack extensions, while preserving exact bottle receipts and lazy payload integrity. Prestart pristine one-shot process workers and cache only exact-content compiled Wasm modules across them. Never reuse Realms, memories, shared buffers, channels, or process state. Add deterministic Node and Chromium query benchmarks, prefix-neutral packaging, and VFS, loader, and SDK support for ordinary dynamic Ruby extensions.
Launch a fresh browser for every focused Chromium sample. Prevent prior renderer and Realm state from leaking across rounds. Keep Worker, memory, and shared-buffer state isolated as well. Reject masked Brew failures that resemble fast zero exits.
Record final three-round Node and Chromium query measurements. Document the rev22 boundary and repository-wide comparison. Capture root cause, artifact cost, and upstream patch accounting. Rank remaining work by measured impact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Read-only Homebrew metadata queries in Kandelo took 20 to 32 seconds.
Warm queries fetched no bytes, yet repeated almost the entire startup,
load-path discovery, process, and syscall cost. The deployed rev22 shell
also lost the Chrome 149 renderer before one complete browser benchmark
round could finish.
This made ordinary commands such as
brew infoimpractical and exposedgeneral Ruby, virtual filesystem (VFS), process-worker, and WebAssembly
compilation costs. The fix needs to preserve POSIX behavior,
authoritative VFS bytes, lazy integrity, and Node/browser parity.
What changed
upstream Bootsnap and msgpack gems.
ordinary
dlopen()anddlsym()path.retaining whole-bottle inventory and digest validation for lazy
payloads.
contain no symlink; retain full POSIX resolution as the fallback.
Worker remains one-shot and is terminated after its process retires.
WebAssembly.Moduleobjects. Cachehits compare current VFS bytes and the cache is bounded to 16 entries,
256 aliases, and 64 MiB of comparison bytes.
It measures cold, booted-first, warm, and eager-image cases against
closed local assets and audits guest network syscalls.
No Realm, memory, shared buffer, channel, or process state is reused.
The central kernel stays in its dedicated Worker. This change does not
alter the ABI.
Upstream patch accounting
There is no
brew infoshortcut and no patch to Homebrew discovery,Ruby
require, Bundler paths, or Bootsnap's cache algorithm.The only new upstream-source patch adds
wasmto three Bootsnap 1.24.5supported-platform regular expressions. Bootsnap and msgpack otherwise
run their genuine upstream implementations. Kandelo's existing
Homebrew bottle tag/relocation and CRuby process-startup patches predate
this work.
Results
Measurements used an Apple M5 Max, Node 24.15.0, Chrome
149.0.7827.55, the published compatibility prefix, current tap inputs,
and three rounds. The committed measurement record contains every
artifact and tap digest.
brew info: 25.56 s on rev22 to 4.62 s, 5.54x faster.crashed. No browser speedup ratio is claimed.
queries fetched zero bytes.
The exact protected-main/candidate repository benchmark also showed:
improved.
fell 11.1%.
isolated exact-artifact control ranged from 1.6% faster to 3.0%
slower. This is reported as run-state sensitivity, not as a
regression-free claim.
Distribution and runtime costs are:
MiB, plus V8-owned compiled code whose size is not exposed.
reserves a 256 MiB object-shape cache contiguously under Wasm.
Validation
build.shinscripts/dev-shell.sh.followed by
benchmarks/compare.ts.WebKit.
Remaining work
A warm text query still launches 159 processes, performs 55 execs, and
makes roughly 29,000 syscalls. About 2,500 failed opens are normal
Ruby/Bundler candidate probing whose
ENOENTresults must staytruthful. General syscall batching, process reduction, Chromium
brew config, CRuby's object-shape reservation, and V8 compiled-codeaccounting remain the largest measured follow-ups.