Skip to content

feat(build): slim txiki.js runtime — binary 6.4 MB → 2.4 MB, v0.9.0 - #36

Merged
lukasMega merged 1 commit into
mainfrom
feat/slim-txiki-runtime
Aug 19, 2026
Merged

feat(build): slim txiki.js runtime — binary 6.4 MB → 2.4 MB, v0.9.0#36
lukasMega merged 1 commit into
mainfrom
feat/slim-txiki-runtime

Conversation

@lukasMega

Copy link
Copy Markdown
Owner

What

Ships the slim-ffi txiki.js runtime from lukasMega/txiki.js-with-slim-builds@slim-v26.6.0-6 (txiki.js v26.6.0) on every platform, and bumps to 0.9.0 (merging this fires auto-tag → release).

Profile keeps tjs:ffi, WebCrypto, run/compile, REPL. Drops TLS, WebAssembly, SQLite, mimalloc and the eval/serve/test/bundle/app subcommands; MinSizeRel + compressed bytecode + hardened + stripped.

TLS costs ~430 KB and buys nothing here — every fetch() in the repo runs in the browser UI, not the runtime.

Size (macOS arm64)

runtime tjs compiled deckbridge
old prebuilt v26.5.1 5.7 MB 6,690,315 B (6.4 MB)
slim-ffi (downloaded) 2.0 MB 2,481,492 B (2.4 MB)
slim-ffi (from source) 1.93 MB 2,448,665 B

Packaged .tar.xz: 1.9 MB.

Changes

  • scripts/tjs-download.mjs — fetches txiki-slim-ffi-<os>-<arch>.zip. macOS x86_64 has no such asset → explicit error pointing at TJS_FROM_SOURCE=1.
  • scripts/tjs-build.mjs — stops hand-rolling cmake flags; clones the tag and runs the fork's own scripts/build-dist.mjs --profile ffi (the same driver that builds the published assets). Now also no-ops when $TJS exists — which is what the release workflow's runtime cache always assumed, so local mise run test drops from ~120 s to ~20 s.
  • release.yml — only macos-x86_64 builds from source now (TJS_FROM_SOURCE comes from the matrix); everything else downloads. Linux release builds re-enabled (linux-x86_64, linux-arm64): the blocker was mise-action blind-installing the github:lukasMega/txiki.js mise tool that had no linux-arm64 asset — that tool entry was unused and is now deleted.
  • mise.toml — one version var instead of two; dead tool/hook blocks gone; per-task re-exports of vars mise already exports gone; rust-fmt/rust-clippy/rust-test, run-ts, largeFiles dropped as verbatim duplicates of rust-lint/s/loc; checkTjs no longer calls $TJS --help (slim compiles help out). 371 → 320 lines.

Verified locally (macOS arm64)

  • Downloaded binary's sha256 matches the release's published BUILDINFO.
  • Full tjs test suite green on both the downloaded and the from-source slim runtime.
  • From-source path green end-to-end (2,026,944 B, inside upstream's budget).
  • Compiled binary mock-boots: web UI 200, CORA 5343 + 5344 listening, FFI dlopen of libhidapi/libdeckbridge_native OK.
  • Packaged artifact extracted and booted standalone; /api/state OK.
  • Startup time unchanged (0.04–0.05 s per test run across all three runtimes).

Untested

Windows (now gets slim via the download path) and the Linux matrix — both are CI-only paths. fail-fast is off, so a Linux failure wouldn't block the other platforms' artifacts.

… MB -> 2.4 MB

Switch both runtime acquisition paths to the `slim-ffi` profile published by
lukasMega/txiki.js-with-slim-builds (tag slim-v26.6.0-6, txiki.js v26.6.0):
libffi in, TLS/WebAssembly/SQLite/mimalloc and the eval/serve/test/bundle/app
subcommands out, MinSizeRel + compressed bytecode + hardened + stripped.

TLS is not needed at runtime: every fetch() in this repo runs in the browser UI,
so the ffi profile saves ~430 KB over ffi-tls for no loss of function.

- tjs-download.mjs now fetches the prebuilt slim asset (verified against the
  release's published sha256). macOS x86_64 has no such asset and gets an
  actionable error pointing at TJS_FROM_SOURCE=1.
- tjs-build.mjs no longer hand-rolls cmake flags; it clones the tag and runs the
  fork's own scripts/build-dist.mjs --profile ffi, i.e. the exact driver that
  produces the published assets. It also no-ops when $TJS already exists, which
  is what the release workflow's runtime cache always assumed.
- Release builds therefore download the slim runtime on every platform except
  macos-x86_64, instead of compiling txiki.js from source on all of them.

Measured on macOS arm64: deckbridge 6,690,315 B -> 2,481,492 B.

Also re-enables the Linux release matrix (linux-x86_64, linux-arm64). The
blocker was mise-action blind-installing the github:lukasMega/txiki.js mise
tool, which had no linux-arm64 asset; that tool entry was unused (mise.toml
points $TJS at an explicit vendor/ path) and is now gone.

mise.toml cleanup along the way: one version variable instead of two, no dead
tool/hook blocks, no per-task re-export of env vars mise already exports, and
the rust-fmt/rust-clippy/rust-test, run-ts and largeFiles tasks dropped as
verbatim duplicates of rust-lint, s and loc.
@lukasMega
lukasMega merged commit 54a8b7d into main Aug 19, 2026
20 of 21 checks passed
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.

1 participant