Skip to content

v0.6.3

Latest

Choose a tag to compare

@NirBarak-RecoLabs NirBarak-RecoLabs released this 27 Nov 13:49
9584473

Changes

Performance

  • EvalMap decodes only the keys an expression reads (#59): StreamEvaluator.EvalMap and Expression.EvalMap used 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, from ReferencedPaths (#57), so a large value no expression reads is never decoded. Root keys are computed once per expression and cached on it.

    BenchmarkEvalMapLargeUnreadKey ns/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 EvalMap fail, since it is never decoded (1+1 over a map with a malformed bad value returns 2 instead of an error). In a StreamEvaluator batch, whether a call fails depends on what all its expressions read. Expressions that may read the whole input still fail on it. EvalBytes and EvalMany (raw JSON input) are unchanged.

Tests

  • Every conformance case with an object input also runs through StreamEvaluator.EvalMap and Expression.EvalMap and must match evaluation of the whole decoded input (1,016 cases, 392 on a pruned input).
  • Fixed a month-dependent $toMillis picture test that failed in every month but October.

npm

  • Package version 0.6.3.