Repository navigation
SRE-868: Replace cargo:wasm-opt with prebuilt Binaryen in mise config - #9105
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
bfb4f7a to
84cff8d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9105 +/- ##
=======================================
Coverage 59.58% 59.58%
=======================================
Files 1410 1410
Lines 137980 137980
Branches 6494 6494
=======================================
+ Hits 82210 82212 +2
+ Misses 54734 54732 -2
Partials 1036 1036 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 18.18%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | bit_matrix/dense/iter_row[64] |
170 ns | 140.8 ns | +20.71% |
| ⚡ | bit_matrix/dense/iter_row[200] |
215 ns | 185.8 ns | +15.7% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/sre-868-wasm-opt-prebuilt (51f1224) with main (9b60522)
…alls Every Vercel build spent ~6m54s compiling the wasm-opt crate from source because cargo-binstall finds no prebuilt binary for it. Install wasm-opt from the WebAssembly/binaryen release binaries (aqua backend) instead, keeping version parity (crate 0.116.1 = binaryen version_116). The Docker images keep cargo:wasm-opt: they build natively for linux/arm64, where Binaryen publishes no release asset.
Use mise's github backend to install prebuilt Binaryen release binaries on every platform, including linux/arm64 (aarch64-linux asset shipped since version_131). This removes the cargo:wasm-opt crate build - the last consumer was the Docker images - so wasm-opt is now one tool at one version everywhere: CI, Vercel installs, and Docker image builds. The aqua backend was considered (registry tags are renovate-friendly) but the aqua registry does not support linux/arm64 for binaryen >= 108, which the arm64 Docker builds need. Lock entries are hand-authored from the release page digests and the .sha256 companion assets (verified to match).
84cff8d to
51f1224
Compare
Benchmark results
|
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| resolve_policies_for_actor | user: empty, selectivity: high, policies: 2002 | Flame Graph | |
| resolve_policies_for_actor | user: empty, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: empty, selectivity: medium, policies: 1002 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: high, policies: 3314 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: medium, policies: 1527 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: high, policies: 2078 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: medium, policies: 1033 | Flame Graph |
policy_resolution_medium
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| resolve_policies_for_actor | user: empty, selectivity: high, policies: 102 | Flame Graph | |
| resolve_policies_for_actor | user: empty, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: empty, selectivity: medium, policies: 52 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: high, policies: 269 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: medium, policies: 108 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: high, policies: 133 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: medium, policies: 63 | Flame Graph |
policy_resolution_none
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| resolve_policies_for_actor | user: empty, selectivity: high, policies: 2 | Flame Graph | |
| resolve_policies_for_actor | user: empty, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: empty, selectivity: medium, policies: 2 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: high, policies: 8 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: medium, policies: 3 | Flame Graph |
policy_resolution_small
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| resolve_policies_for_actor | user: empty, selectivity: high, policies: 52 | Flame Graph | |
| resolve_policies_for_actor | user: empty, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: empty, selectivity: medium, policies: 26 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: high, policies: 94 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: seeded, selectivity: medium, policies: 27 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: high, policies: 66 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: low, policies: 1 | Flame Graph | |
| resolve_policies_for_actor | user: system, selectivity: medium, policies: 29 | Flame Graph |
read_scaling_complete
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| entity_by_id;one_depth | 1 entities | Flame Graph | |
| entity_by_id;one_depth | 10 entities | Flame Graph | |
| entity_by_id;one_depth | 25 entities | Flame Graph | |
| entity_by_id;one_depth | 5 entities | Flame Graph | |
| entity_by_id;one_depth | 50 entities | Flame Graph | |
| entity_by_id;two_depth | 1 entities | Flame Graph | |
| entity_by_id;two_depth | 10 entities | Flame Graph | |
| entity_by_id;two_depth | 25 entities | Flame Graph | |
| entity_by_id;two_depth | 5 entities | Flame Graph | |
| entity_by_id;two_depth | 50 entities | Flame Graph | |
| entity_by_id;zero_depth | 1 entities | Flame Graph | |
| entity_by_id;zero_depth | 10 entities | Flame Graph | |
| entity_by_id;zero_depth | 25 entities | Flame Graph | |
| entity_by_id;zero_depth | 5 entities | Flame Graph | |
| entity_by_id;zero_depth | 50 entities | Flame Graph |
read_scaling_linkless
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| entity_by_id | 1 entities | Flame Graph | |
| entity_by_id | 10 entities | Flame Graph | |
| entity_by_id | 100 entities | Flame Graph | |
| entity_by_id | 1000 entities | Flame Graph | |
| entity_by_id | 10000 entities | Flame Graph |
representative_read_entity
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1
|
Flame Graph | |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1
|
Flame Graph | |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1
|
Flame Graph | |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1
|
Flame Graph | |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2
|
Flame Graph | |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1
|
Flame Graph | |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1
|
Flame Graph | |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1
|
Flame Graph | |
| entity_by_id | entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1
|
Flame Graph |
representative_read_entity_type
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| get_entity_type_by_id | Account ID: bf5a9ef5-dc3b-43cf-a291-6210c0321eba
|
Flame Graph |
representative_read_multiple_entities
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| entity_by_property | traversal_paths=0 | 0 | |
| entity_by_property | traversal_paths=255 | 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true | |
| entity_by_property | traversal_paths=2 | 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false | |
| entity_by_property | traversal_paths=2 | 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true | |
| entity_by_property | traversal_paths=2 | 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true | |
| entity_by_property | traversal_paths=2 | 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true | |
| link_by_source_by_property | traversal_paths=0 | 0 | |
| link_by_source_by_property | traversal_paths=255 | 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true | |
| link_by_source_by_property | traversal_paths=2 | 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false | |
| link_by_source_by_property | traversal_paths=2 | 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true | |
| link_by_source_by_property | traversal_paths=2 | 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true | |
| link_by_source_by_property | traversal_paths=2 | 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true |
scenarios
| Function | Value | Mean | Flame graphs |
|---|---|---|---|
| full_test | query-limited | Flame Graph | |
| full_test | query-unlimited | Flame Graph | |
| linked_queries | query-limited | Flame Graph | |
| linked_queries | query-unlimited | Flame Graph |
PR SummaryLow Risk Overview Mise now pins Dockerfiles (hash-api, hash-frontend, hash-ai-worker-ts, hash-integration-worker) and Vercel install scripts (hash-frontend, petrinaut-website) swap Note: optimizer version moves from the old ~116 line to Binaryen 131, which may slightly change WASM optimization output. Reviewed by Cursor Bugbot for commit 51f1224. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Pull request overview
Replaces source-built wasm-opt with prebuilt Binaryen assets to reduce installation time across CI, Vercel, and Docker builds.
Changes:
- Pins Binaryen
version_131through mise’s GitHub backend. - Adds checksummed lock entries for Linux and macOS architectures.
- Updates Vercel and Docker installation commands.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.config/mise/config.toml |
Configures prebuilt Binaryen. |
.config/mise/mise.lock |
Locks platform-specific Binaryen assets. |
apps/hash-api/docker/Dockerfile |
Installs Binaryen in API builds. |
apps/hash-frontend/docker/Dockerfile |
Installs Binaryen in frontend builds. |
apps/hash-ai-worker-ts/docker/Dockerfile |
Installs Binaryen in AI worker builds. |
apps/hash-integration-worker/docker/Dockerfile |
Installs Binaryen in integration worker builds. |
apps/hash-frontend/vercel-install.sh |
Uses Binaryen during Vercel installation. |
apps/petrinaut-website/vercel-install.sh |
Uses Binaryen during Vercel installation. |
Requested by Ciaran Morinan, Tim Diekmann · Slack thread
🌟 What is the purpose of this PR?
Before: every Vercel frontend build spent ~6m54s — roughly 75% of the 9-minute install phase — compiling the
wasm-optcrate from source. cargo-binstall can never find a prebuilt binary for it, because the crates.iowasm-optcrate (brson/wasm-opt-rs) publishes no release binaries; the real prebuiltwasm-optbinaries live in WebAssembly/binaryen releases.After:
wasm-optcomes from the prebuilt Binaryenversion_131release binaries on every platform — Vercel installs, CI, and the linux/arm64 Docker image builds (version_131is the first Binaryen release that ships anaarch64-linuxasset). Downloads take seconds, andcargo:wasm-optis removed entirely: one tool, one version, everywhere.How:
"github:WebAssembly/binaryen" = "version_131"uses mise'sgithubbackend to install release assets directly. Theaquabackend was considered first (its registry converts Binaryen'sversion_131-style tags, which keeps renovate updates working, per Bilal) — but the aqua registry constrains binaryen ≥ 108 tosupported_envs: [darwin, amd64]and has no arm64→aarch64 asset-name mapping for linux, soaqua:WebAssembly/binaryenfails on linux/arm64 at any version and can't serve the arm64 Docker builds. An upstream aqua-registry PR adding linux/arm64 support would allow switching back later.The
mise.lockentries are hand-authored for all four platforms (linux-x64,linux-arm64,macos-arm64,macos-x64—version_131publishes assets for all of them). Checksums were taken from the sha256 digests GitHub displays on the release page and cross-checked against the.sha256companion assets (they match for all four). The tarball's nestedbinaryen-version_131/bin/layout is handled by mise's automaticstrip_components+ bin-directory detection, sowasm-optlands onPATHvia mise shims andwasm-packfinds it as before.🔗 Related links
🔍 What does this change?
.config/mise/config.toml: replaces both"aqua:WebAssembly/binaryen" = "version_116"and"cargo:wasm-opt" = "0.116.1"with a single"github:WebAssembly/binaryen" = "version_131".config/mise/mise.lock: removes thecargo:wasm-optand aqua Binaryen entries; addsgithub:WebAssembly/binaryenentries forlinux-x64,linux-arm64,macos-arm64, andmacos-x64(URL + sha256 each)apps/{hash-api,hash-frontend,hash-ai-worker-ts,hash-integration-worker}/docker/Dockerfile: swapcargo:wasm-opt→github:WebAssembly/binaryenin themise install --lockedtool list (these images build for linux/arm64, now covered by theaarch64-linuxasset)apps/hash-frontend/vercel-install.shandapps/petrinaut-website/vercel-install.sh: swapaqua:WebAssembly/binaryen→github:WebAssembly/binaryenPre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
0.116.1); they now use binaryen 131.wasm-packinvokeswasm-optidentically, but the optimizer itself is 15 releases newer.githubbackend tracks release tags verbatim (version_131), unlike the aqua registry's tag conversion — the renovate mise manager may need a check that it picks upversion_...tags for this tool; if not, updates are a one-line manual bump.url_apiasset-id fields (api.github.com for WebAssembly/binaryen is unreachable from the sandbox this was authored in).mise lockon a dev machine would normalize the entries if wanted — CI'smise install --lockedwill tell if the hand-authored form is insufficient.mise installwill download the Binaryen tarball (~86 MB on linux-x64, ~7 MB on macOS).🐾 Next steps
github:WebAssembly/binaryenandcargo:wasm-packcan be dropped altogether.aarch64replacement) support for binaryen ≥ 131, then switch back toaqua:for registry-managed renovate updates.🛡 What tests cover this?
mise install --env ci --jobs 1 --lockedon linux-x64, which installs the tool from the locked URL and verifies its checksum.mise install --locked … github:WebAssembly/binaryenon linux/arm64, exercising theaarch64-linuxlock entry.❓ How to test this?
cargo:wasm-optcompile).github:WebAssembly/binaryenshould install in seconds andwasm-packbuilds should still findwasm-opt.aarch64-linuxasset instead of compiling the crate.