Skip to content

Upgrade js_of_ocaml and wasm_of_ocaml to 6.5.0 - #9051

Merged
cknitt merged 2 commits into
masterfrom
jsoo-6.5.0
Oct 26, 2026
Merged

cknitt merged 2 commits into
masterfrom
jsoo-6.5.0

Conversation

@cknitt

@cknitt cknitt commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #9043: bumps js_of_ocaml and wasm_of_ocaml-compiler from 6.4.1 to 6.5.0 (pins in dune-project and rescript.opam).

Motivation

js_of_ocaml only builds the playground compiler, so this is about the playground and the CI job that builds it. 6.5.0 (changelog) brings:

  • Faster linking. Upstream reports about 25% faster compilation of large programs. For the playground bundle, js_of_ocaml uses about 28% less CPU and wasm_of_ocaml about 10% less (table below).
  • Smaller output. Identical literals share one variable, and the generated JavaScript is simpler (!x conditions, fewer temporaries, return c ? a : b). compiler.js shrinks by 10% raw and 5.5% gzipped. The Wasm build shrinks by 19%.
  • Soundness fixes. These include JavaScript simplification passes that were unsound in corner cases, reference unboxing, an invariant violation with recursive inlining, and the JS printer.
  • Keeping current. 6.5.0 supports OCaml 5.6, which matters for later toolchain bumps.

The two breaking changes (Typed_array.float*Array_fromArray and the removed js_of_ocaml-lwt.logger) don't affect us. compiler/jsoo uses neither.

cmij files are now written without build-fs

In 6.5.0, js_of_ocaml build-fs encodes file contents as base64 literals, decoded by the runtime primitive caml_jsbytes_of_base64. Two problems follow for the playground's cmij files:

  1. The playground loads them as standalone scripts next to compiler.js, where that primitive isn't in scope, so make playground-test fails with ReferenceError: caml_jsbytes_of_base64 is not defined.
  2. Base64 hides the byte structure from compression, so the cmij files got about 40% larger gzipped (runtime cmij: 303 KB → 424 KB). Together the playground's download grew by 13%.

A cmij file is just a list of jsoo_create_file(name, bytes) calls. generate_cmijs.mjs now writes them itself, as escaped byte-string literals like the ones 6.4.1 produced. Loaded into a pseudo filesystem, the new files hold the same 306 files with byte-identical contents as 6.4.1's build-fs output. Generating them no longer needs js_of_ocaml on the PATH.

Measurements

These were taken in a Docker container on macOS with OCaml 5.5.2 and the browser profile, from cold builds. Sizes are deterministic. Times are two runs each, read from dune's trace (process CPU time), and should be treated as indicative only.

Files the playground downloads:

6.4.1 raw 6.4.1 gzip / brotli 6.5.0 (this PR) raw 6.5.0 gzip / brotli
compiler.js 2,454,408 625,014 / 493,403 2,210,871 590,680 / 473,235
runtime cmij 2,217,670 302,555 / 215,181 2,277,129 309,680 / 217,946
belt cmij 956,802 127,000 / 84,689 978,346 128,796 / 85,333
react cmij 267,784 40,743 / 31,338 270,786 40,501 / 30,853
total 5,896,664 1,095,312 / 824,611 5,737,132 1,069,657 / 807,367 (−2.3% / −2.1%)

With 6.5.0's own build-fs the total would have been 1,239,890 gzip / 935,592 brotli (+13%).

Not shipped: the Wasm build (.bc.wasm) goes from 3,377,349 to 2,734,673 bytes.

Link steps in make playground (CPU time, two runs):

6.4.1 6.5.0
js_of_ocaml 7.4 s, 7.4 s 5.2 s, 5.4 s
wasm_of_ocaml 27.1 s, 28.1 s 23.8 s, 26.0 s

Notes

  • An internal changelog fragment, as in Upgrade OCaml toolchain to 5.5.2 #9043: this changes the toolchain and how the playground is packaged, not compiler behavior.
  • CI's opam cache key hashes *.opam, so CI builds a fresh switch with the new pins.
  • Locally: opam install js_of_ocaml.6.5.0 wasm_of_ocaml-compiler.6.5.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RXfJoyYrXm1fPyDMWV8xnx

6.5.0 links the playground compiler faster and emits a smaller bundle.
Its build-fs now encodes file contents in base64, which compresses worse
and needs a runtime primitive the standalone cmij files cannot reach, so
the playground writes its cmij files itself, with the same contents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXfJoyYrXm1fPyDMWV8xnx
Signed-off-by: Christoph Knittel <ck@cca.io>
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Changelog

🏠 Internal

  • Upgrade js_of_ocaml and wasm_of_ocaml to 6.5.0 for a smaller, faster-building playground compiler.

Semantic Diff

2 commits · Full page

Upgrade js_of_ocaml and wasm_of_ocaml to 6.5.0

0841977 · cknitt + Claude · Oct 26, 2026, 09:18 UTC

6.5.0 links the playground compiler faster and emits a smaller bundle. Its build-fs now encodes file contents in base64, which compresses worse and needs a runtime primitive the standalone cmij files cannot reach, so the playground writes its cmij files itself, with the same contents.

✨ Add changelog fragment

88c1ef9 · cknitt + Claude · Oct 26, 2026, 09:44 UTC · new

The changelog check requires a fragment; this one notes the toolchain bump.

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.37%. Comparing base (eb08738) to head (88c1ef9).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9051      +/-   ##
==========================================
+ Coverage   81.33%   81.37%   +0.04%     
==========================================
  Files         456      458       +2     
  Lines       64273    64503     +230     
==========================================
+ Hits        52275    52490     +215     
- Misses      11998    12013      +15     

see 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The changelog check requires a fragment; this one notes the toolchain bump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXfJoyYrXm1fPyDMWV8xnx
Signed-off-by: Christoph Knittel <ck@cca.io>
@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@9051

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@9051

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@9051

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@9051

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@9051

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@9051

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@9051

commit: 88c1ef9

@github-actions

Copy link
Copy Markdown

@cknitt

cknitt commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T10:25:53.252350Z 88c1ef9 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 88c1ef9950

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cknitt
cknitt requested a review from fhammerschmidt October 26, 2026 12:25
@cknitt
cknitt marked this pull request as ready for review October 26, 2026 12:25
@cknitt
cknitt merged commit 230405f into master Oct 26, 2026
26 checks passed
@cknitt
cknitt deleted the jsoo-6.5.0 branch October 26, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants