@seantalts/stanli 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,7 +35,7 @@ WASM runtime plus the stanc3 compiler. The compiler loads lazily, only
35
35
  when a call passes Stan source. `preload()` starts both loads in the
36
36
  background; call it at page idle so the first `sample()` skips the
37
37
  fetch and parse. An app that ships a fixed model can precompile it at
38
- build time (`stanc --debug-transformed-mir model.stan`) and pass `mir`
38
+ build time (`stanc --O1 --debug-optimized-mir model.stan`) and pass `mir`
39
39
  instead of `code`; the runtime alone is ~1.5 MB gzipped.
40
40
 
41
41
  118 of 119 posteriordb corpus models verify against CmdStan's log
package/index.mjs CHANGED
@@ -12,7 +12,7 @@
12
12
  // one chain each -- run simultaneously. Compiling once and passing `mir`
13
13
  // keeps the 2.8 MB compiler in a single worker (or out of the page
14
14
  // entirely, if the model was precompiled at build time with
15
- // stanc --debug-transformed-mir).
15
+ // stanc --O1 --debug-optimized-mir).
16
16
 
17
17
  const pool = [];
18
18
  const waiters = [];
@@ -99,8 +99,8 @@ export function compile(opts) {
99
99
  * @param {Object} opts
100
100
  * @param {string} [opts.code] Stan source (compiled in the worker by
101
101
  * stanc3, which loads lazily on first use).
102
- * @param {string} [opts.mir] Precompiled transformed MIR (from
103
- * `compile()` here, or `stanc --debug-transformed-mir` at build time).
102
+ * @param {string} [opts.mir] Precompiled MIR (from `compile()`
103
+ * here, or `stanc --O1 --debug-optimized-mir` at build time).
104
104
  * When given, the 2.8 MB compiler never loads: the runtime alone is
105
105
  * ~1.3 MB gzipped.
106
106
  * @param {Object|string} [opts.data] Data as an object or JSON text.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seantalts/stanli",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "Full Stan in the browser: stanc3 compiles the model in JS, a WASM runtime lowers it to an op graph and runs NUTS. No server, no C++ toolchain.",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
package/stanli.wasm CHANGED
Binary file
package/worker.js CHANGED
@@ -38,7 +38,7 @@ onmessage = async (e) => {
38
38
  // and never load the compiler.
39
39
  say("compiling Stan -> MIR (stanc3)");
40
40
  ensureStanc();
41
- const sc = stanc("browser_model", req.code, ["debug-transformed-mir"]);
41
+ const sc = stanc("browser_model", req.code, ["O1", "debug-optimized-mir"]);
42
42
  if (sc.errors) throw new Error(Array.from(sc.errors).join("\n"));
43
43
  postMessage({ done: { mir: String(sc.result),
44
44
  ms: { stanc: performance.now() - t0 } } });
@@ -49,7 +49,7 @@ onmessage = async (e) => {
49
49
  if (!mir) {
50
50
  say("compiling Stan -> MIR (stanc3)");
51
51
  ensureStanc();
52
- const sc = stanc("browser_model", req.code, ["debug-transformed-mir"]);
52
+ const sc = stanc("browser_model", req.code, ["O1", "debug-optimized-mir"]);
53
53
  if (sc.errors) throw new Error(Array.from(sc.errors).join("\n"));
54
54
  mir = String(sc.result);
55
55
  }