Changes
Performance
-
EvalMapdecodes only the keys an expression reads (#59):StreamEvaluator.EvalMapandExpression.EvalMapused to decode every value in the input map before a full evaluation. They now decode only the top-level keys the batch's expressions read, fromReferencedPaths(#57), so a large value no expression reads is never decoded. Root keys are computed once per expression and cached on it.BenchmarkEvalMapLargeUnreadKeyns/op B/op allocs/op v0.6.2 ~570,000 816,790 4,065 v0.6.3 ~3,000 2,312 52 Pruning applies only when every expression in the batch is
complete. An expression that may read keys it doesn't name ($keys($),*,**,$string(), a custom function given the context, an unbound or re-bound variable) gets the whole map decoded, as before. On a small map with nothing to prune, cost is unchanged apart from one 16-byte allocation per call. No public API change.
Behavior change
- A malformed value under a key no expression reads no longer makes
EvalMapfail, since it is never decoded (1+1over a map with a malformedbadvalue returns2instead of an error). In aStreamEvaluatorbatch, whether a call fails depends on what all its expressions read. Expressions that may read the whole input still fail on it.EvalBytesandEvalMany(raw JSON input) are unchanged.
Tests
- Every conformance case with an object input also runs through
StreamEvaluator.EvalMapandExpression.EvalMapand must match evaluation of the whole decoded input (1,016 cases, 392 on a pruned input). - Fixed a month-dependent
$toMillispicture test that failed in every month but October.
npm
- Package version 0.6.3.