Documentation
    Preparing search index...

    Module evaluator

    Evaluates Saltcorn expressions and {{ }} interpolations.

    Expressions were previously run by building a new vm2 VM for every evaluation. A VM costs around half a millisecond to construct - most of it creating a V8 context and proxy-bridging the intrinsics - which a List view pays once per cell (issue #4298).

    This keeps the VM instead. An expression is compiled once into a function whose parameters are the names in scope, exactly as eval_expression already wrote it:

    ((row, name, age) => (expression))
    

    and each row is then just a call with arguments. Because the values arrive as arguments, nothing is written to the shared sandbox, so one VM can serve every row without evaluations interfering with each other.

    Lives on State (getState().evaluator) and is discarded whenever the eval_context changes, so the sandbox cannot go stale.

    Classes

    Evaluator