Changes
Features
- TinyGo / WASI support. gnata builds and runs identically under TinyGo for
wasip1, including-scheduler=none. The full jsonata-js conformance suite passes with no differences from native. See the TinyGo section in the README and the newexamples/wasi. (#33) and/or/$notfast path. Compositions of fast-eligible leaves are now answered on the byte fast path instead of decoding the document, exposed asExpression.IsBooleanFastPath(). Batches with these conditions are up to 99% faster. (#32)WithReadOnlyCustomFuncArgs()(opt-inStreamEvaluatoroption): custom functions share a cachedmap[string]anyview of evaluator-decoded input objects instead of a fresh copy per call. Default behaviour is unchanged. (#33)
Performance (#33)
- Native geomean −7.0% time, −8.9% allocations;
EvalByteson complex expressions −37% to −40%;StreamEvaluator−27%. - WASM (Go
wasip1) −7.8%; TinyGo is about 1.9× faster than Gowasip1with a binary about 5× smaller. - Single-pass
DecodeJSON, single-buffer JSON encoding, allocation-free plan-cache lookup and an inlined per-node cancellation check.Evalon pre-parsed data allocates exactly as before.
Fixes
- Path-vs-literal
=/!=comparisons whose walked path ends on a one-element array returned the opposite result on the byte fast path (regression since v0.4.0). (#32) StreamEvaluatorbypassed a custom function registered under a fast-path builtin name (e.g.$exists). (#32)- Range operator: huge bounds no longer wrap or loop forever (
[1e20..1e20]previously exhausted memory). (#33) - Numeric arguments are clamped instead of overflowing on conversion to
int(indexes,$substring,$round,$pad,$split/$match/$replacelimits,$formatBase,$flatten). (#33) - Decoded strings and the regex cache no longer retain references to caller buffers. (#33)
Behaviour changes (#33)
-
Out-of-range numeric arguments (≥ 2⁶³ or ≤ −2⁶³) to
$substring,$split,$matchand$replacenow behave as "unbounded", like jsonata-js. -
Infinite range bounds return T2003 / T2004.
-
WithTimeoutis enforced at function-call granularity without a timer goroutine; a single builtin or custom-function call isn't interrupted. -
Invalid UTF-8 in strings encodes as a raw U+FFFD on every toolchain (as Go 1.25+'s default
encoding/jsondoes). -
Custom functions: arrays of scalars are passed through uncopied and must not be modified (maps are still copied per call).
-
npm:
gnata-js@0.5.1