From dc2f919ccc8c3776b229371ad17116dcefc9b95c Mon Sep 17 00:00:00 2001 From: El1as42 Date: Wed, 21 Oct 2026 15:23:12 +0200 Subject: [PATCH 1/2] fix: pin ONNX Runtime Web 1.20.1 for the browser demo Every onnxruntime-web release from 1.21.0 (checked up to 1.30.0) makes WebKit, the Safari engine, use 4.8-7.6 GB on a 60 s file; with 1.22.0 a 10 minute file reached 12 GB and once crashed the page. 1.20.1 stays at about 1 GB on 60 s and 1.8 GB on 600 s, the same as Chromium and Firefox, and is not slower there. All three engines give 370/370 boxes against Python ONNX Runtime on a 600 s file. Co-Authored-By: Claude Opus 5.5 --- docs/javascripts/onnx_demo.js | 6 +++++- mkdocs.yml | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/javascripts/onnx_demo.js b/docs/javascripts/onnx_demo.js index 9523512..8aa77d6 100644 --- a/docs/javascripts/onnx_demo.js +++ b/docs/javascripts/onnx_demo.js @@ -165,9 +165,13 @@ ort.env.wasm.proxy = true; ort.env.wasm.numThreads = Math.min(4, navigator.hardwareConcurrency || 2); ort.env.wasm.simd = true; + // Same release as the ort.min.js tag in mkdocs.yml. 1.20.1 on purpose: every + // release from 1.21.0 (checked up to 1.30.0) needs 5-7 GB in WebKit (Safari) + // even for 60 s of audio, 1.20.1 about 1 GB. Chromium and Firefox run the + // same on both. if (!ort.env.wasm.wasmPaths) { ort.env.wasm.wasmPaths = - "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.22.0/dist/"; + "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.20.1/dist/"; } } diff --git a/mkdocs.yml b/mkdocs.yml index 1c82b0d..a2a76ef 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -89,7 +89,9 @@ extra_javascript: - https://unpkg.com/tablesort@5.3.0/dist/tablesort.min.js - https://unpkg.com/tablesort@5.3.0/dist/sorts/tablesort.number.min.js - javascripts/tablesort.js - - https://cdn.jsdelivr.net/npm/onnxruntime-web@1.22.0/dist/ort.min.js + # Pinned to 1.20.1: from 1.21.0 on (checked up to 1.30.0), WebKit uses 5-7 GB + # on a 60 s file (1.20.1: about 1 GB). Keep wasmPaths in onnx_demo.js in sync. + - https://cdn.jsdelivr.net/npm/onnxruntime-web@1.20.1/dist/ort.min.js - javascripts/onnx_spectrogram.js - javascripts/onnx_demo.js From 5e1ac6134416e647ab2c0b99eb7f888dd65889b7 Mon Sep 17 00:00:00 2001 From: El1as42 Date: Wed, 21 Oct 2026 16:13:15 +0200 Subject: [PATCH 2/2] fix: load the WASM-only ONNX Runtime bundle in the browser demo The WebKit memory problem comes from the JSEP wasm, not from the release: from 1.21.0 on, ort.min.js loads ort-wasm-simd-threaded.jsep.wasm even for the CPU backend. ort.wasm.min.js loads the plain build in every release (1.30.0: 1.2 GB in WebKit on 60 s instead of 5.6 GB), so a later version bump cannot bring the problem back. Stays on 1.20.1: its wasm is the smallest (11 MB; 1.30.0: 14 MB) and it matches Python ONNX Runtime box for box (370/370 on 600 s in WebKit, Chromium and Firefox), where 1.30.0 differs by two boxes. Co-Authored-By: Claude Opus 5.5 --- docs/javascripts/onnx_demo.js | 7 +++---- mkdocs.yml | 9 ++++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/javascripts/onnx_demo.js b/docs/javascripts/onnx_demo.js index 8aa77d6..563d64f 100644 --- a/docs/javascripts/onnx_demo.js +++ b/docs/javascripts/onnx_demo.js @@ -165,10 +165,9 @@ ort.env.wasm.proxy = true; ort.env.wasm.numThreads = Math.min(4, navigator.hardwareConcurrency || 2); ort.env.wasm.simd = true; - // Same release as the ort.min.js tag in mkdocs.yml. 1.20.1 on purpose: every - // release from 1.21.0 (checked up to 1.30.0) needs 5-7 GB in WebKit (Safari) - // even for 60 s of audio, 1.20.1 about 1 GB. Chromium and Firefox run the - // same on both. + // Same release as the ort.wasm.min.js tag in mkdocs.yml. That bundle loads + // the plain ort-wasm-simd-threaded.wasm; ort.min.js would load the JSEP + // build, which needs 5-7 GB in WebKit (Safari) instead of about 1 GB. if (!ort.env.wasm.wasmPaths) { ort.env.wasm.wasmPaths = "https://cdn.jsdelivr.net/npm/onnxruntime-web@1.20.1/dist/"; diff --git a/mkdocs.yml b/mkdocs.yml index a2a76ef..c2265d7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -89,9 +89,12 @@ extra_javascript: - https://unpkg.com/tablesort@5.3.0/dist/tablesort.min.js - https://unpkg.com/tablesort@5.3.0/dist/sorts/tablesort.number.min.js - javascripts/tablesort.js - # Pinned to 1.20.1: from 1.21.0 on (checked up to 1.30.0), WebKit uses 5-7 GB - # on a 60 s file (1.20.1: about 1 GB). Keep wasmPaths in onnx_demo.js in sync. - - https://cdn.jsdelivr.net/npm/onnxruntime-web@1.20.1/dist/ort.min.js + # WASM-only bundle on purpose: from 1.21.0 on, ort.min.js loads the JSEP wasm + # even for the CPU backend, and WebKit (Safari) then needs 5-7 GB for 60 s of + # audio instead of about 1 GB. 1.20.1 has the smallest wasm (11 MB; 1.30.0: + # 14 MB) and matches Python ONNX Runtime box for box. Keep the version in sync + # with wasmPaths in onnx_demo.js. + - https://cdn.jsdelivr.net/npm/onnxruntime-web@1.20.1/dist/ort.wasm.min.js - javascripts/onnx_spectrogram.js - javascripts/onnx_demo.js