From b5ee3da92ce3e88ddffbe7ba365069397d184e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20T=C3=B6rcsv=C3=A1ri?= Date: Wed, 1 Jul 2026 12:21:54 +0200 Subject: [PATCH] perf(cdn): publish demo WASM as brotli-q11 + no-transform release.yml's publish-wasm job now uploads .wasm/.js with `--compress br --quality 11` instead of gzip-6, and IMMUTABLE content-addressed blobs carry `no-transform` so Cloudflare's edge can't decompress + re-serve them at its on-the-fly br-4 (and the original Content-Length passes through). ~15-20% smaller wasm on cdn.pcbjam.com. Forward-only: tool folders already published stay gzip until their source changes (identity is hashed over uncompressed bytes, so the compressor switch never re-versions or re-uploads existing folders). Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/release.yml | 2 +- scripts/deploy/lib/cdn-store.mjs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f64ea16..bd0f1aa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,7 +82,7 @@ jobs: - name: Publish WASM to CDN run: > node scripts/deploy/publish-wasm.mjs --tag "${{ needs.meta.outputs.tag }}" - --src output --driver r2 --bucket "$BUCKET" --remote --compress gzip + --src output --driver r2 --bucket "$BUCKET" --remote --compress br --quality 11 # 3) Build the standalone pinned to this tag's manifest + libs, deploy to Pages. deploy-demo: diff --git a/scripts/deploy/lib/cdn-store.mjs b/scripts/deploy/lib/cdn-store.mjs index 75b7057..bafb697 100644 --- a/scripts/deploy/lib/cdn-store.mjs +++ b/scripts/deploy/lib/cdn-store.mjs @@ -17,7 +17,10 @@ import { gzipSync, brotliCompressSync, constants as zc } from "node:zlib"; import { tmpdir } from "node:os"; import { join, dirname } from "node:path"; -export const IMMUTABLE = "public, max-age=31536000, immutable"; +// `no-transform` keeps Cloudflare's edge from decompressing our pre-compressed +// (brotli-q11) blobs and re-serving them at its own on-the-fly quality (br-4); +// also preserves the original Content-Length. Immutable content-addressed blobs. +export const IMMUTABLE = "public, max-age=31536000, immutable, no-transform"; export const NO_STORE = "no-store"; export const sha256hex = (buf) => createHash("sha256").update(buf).digest("hex");