vega v5.13.0 Release Notes

Release Date: 2020-06-02 // almost 4 years ago
  • Notable Changes

    ๐Ÿ‘Œ Improved Streaming Performance.

    ๐ŸŽ For performance, Vega caches a lot of internal data structures, including calculated tuples, scenegraph items, and SVG DOM nodes. Previously, nested scopes (such as those created for facetted data) that result in vega-runtime subcontexts were never cleaned. If no external View API calls are made, this is fine, and actually improves performance for interaction-driven dynamic filtering. However, when providing streaming data to Vega through the View API, uncleaned caches and subcontexts can result in substantial memory leaks that also eventually degrade performance.

    ๐Ÿšฆ This version adds mechanisms for clearing caches and detaching subflows to support streaming data within nested specifications. When input data is removed via a View API call or via signal-valued URL, Vega will now by default trigger garbage collection to reclaim resources. This behavior can be disabled by calling clean(false) on a constructed ChangeSet passed to the View API.

    ๐Ÿ‘Œ Improved Cursor Performance.

    ๐ŸŽ Previously Vega updated the cursor style on the HTML document body. This persists cursor settings even during interactions (such as drags) that may leave the Vega View component. However, it also can result in large performance penalties in Chrome, which re-evaluates CSS styles in response. This version changes the default behavior to set the cursor locally on the Vega View component. If a global cursor is desired, the boolean config property events.globalCursor can be set true or the View method globalCursor can be invoked to change the setting at runtime.

    Optional Expression Interpreter.

    ๐Ÿš€ This release adds interpreter support for Vega expressions that is Content Security Policy (CSP) compliant. By default, the Vega parser performs code generation for parsed Vega expressions, and the Vega runtime uses the Function constructor to create JavaScript functions from the generated code. Although the Vega parser includes its own security checks, the runtime generation of functions from source code nevertheless violates security policies designed to prevent cross-site scripting.

    This release provides an interpreter plug-in (the new vega-interpreter package) that evaluates expressions by traversing an Abstract Syntax Tree (AST) for an expression and performing each operation in turn. Use of the interpreter enables compliance with CSP, but can incur a performance penalty. In tests of initial parse and dataflow evaluation times, the interpreter is on average ~10% slower. Interactive updates may incur higher penalties, as they are often more expression-heavy and amortize the one-time cost of Function constructor parsing.

    ๐Ÿ”„ Changelog

    ๐Ÿš€ Changes from v5.12.3:

    vega

    • ๐ŸŽ Update stream.html and stream-nested.html performance test pages.

    vega-dataflow

    • โž• Add detach method to Operator to remove adjacent edges (listeners) from the dataflow graph.
    • โž• Add clean setter to ChangeSet, set to true by default if any tuples are removed.
    • โž• Add clean getter/setter to Pulse, propagate value to forked pulses if they share a data source.
    • โšก๏ธ Update logging calls during Dataflow evaluation.

    vega-encode

    • โšก๏ธ Update DataJoin transform to clean internal map when pulse.clean() is true.
    • โšก๏ธ Update Scale to include domainMid as an extrema if it exceeds the domain min or max. (#2656)

    vega-functions

    • ๐Ÿ›  Fix scale function to not special case undefined input. This ensures identical semantics with the internal _scale helper function used by code-generated encoders.

    vega-geo

    • โšก๏ธ Update d3-geo dependency.

    vega-interpreter

    • โž• Add new vega-interpreter package.

    vega-projection

    • โšก๏ธ Update d3-geo dependency.

    vega-projection-extended

    • โšก๏ธ Update vega-projection dependency.

    vega-runtime

    • โž• Add runtime detach method to remove subcontexts. Export as detachSubflow on the head operator of a generated subflow.
    • โž• Add pluggable expression evaluators.

    vega-statistics

    • ๐Ÿ›  Fix numbers utility to exclude empty string.

    vega-transforms

    • โšก๏ธ Update Aggregate transform to clean internal map when pulse.clean() is true.
    • โšก๏ธ Update Facet, PreFacet, and Subflow transforms to prune subflows in response to pulse.clean().
    • โšก๏ธ Update Load transform to set pulse.clean(true) when removing loaded data.
    • ๐Ÿ›  Fix Bin and Extent to treat empty string as a missing value. (thanks @domoritz!)
    • ๐Ÿ›  Fix aggregate ops to treat empty string as a missing value.

    vega-typings

    • โž• Add eventConfig.globalCursor to config typings.
    • โž• Add dataflow logger to typings.
    • โž• Add parse options to typings.

    vega-util

    • ๐Ÿ”จ Refactor code for fastmap and visitArray utilities.

    vega-view

    • โž• Add View constructor option expr to pass in a custom expression evaluator.
    • โž• Add globalCursor method and event configuration.
    • โšก๏ธ Update to make the Vega view container the default cursor target.