Skip to content

Page load: ship a Plotly bundle with only the trace types FlexViz uses #125

Open

Description

@jvdd

Context

FlexViz loads the full [email protected] from jsDelivr: 4.8 MB raw, 1.41 MB on the wire. FlexViz uses 8 Plotly trace types: scatter, bar, box, heatmap, pie, treemap, scattermap and choroplethmap (flexviz/adapters/js/plotly/traces.js).

A renderer review on 2026-09-28 found that page load is where Plotly costs the most, much more than in zoom or cross-filter. A bundle with only the FlexViz trace types cuts that cost. This is not a priority now. This issue records the measurements for later.

Findings

Measured on an Apple M5 with Chromium 153 (headless, GPU on). Cold visits: no HTTP cache and no V8 code cache. Median of 12 fresh browser contexts.

Bundle Raw Compressed Script eval, 1x CPU Script eval, 4x CPU
Full dist-min 4.1.1 (today) 4.82 MB 1.41 MB (jsDelivr brotli) 544 ms 2,148 ms
Official cartesian partial 1.50 MB 0.50 MB (jsDelivr) 205 ms 780 ms
Custom: FlexViz traces, maps included 3.24 MB 0.73 MB (brotli 11) 124 ms 378 ms
Custom: FlexViz traces, no maps 1.41 MB 0.38 MB (brotli 11) 72 ms 221 ms

Page load of a 4-figure dashboard (line, grouped line, histogram, histogram2d over 10M rows). Time runs from the arrival of the Plotly bytes until all 4 figures are painted:

Bundle 1x CPU 4x CPU
Full (today) 786 ms (Plotly eval: 579 ms) 2,937 ms (Plotly eval: 2,228 ms)
Custom, maps included 336 ms 1,097 ms

The zoom and cross-filter times did not change with the custom bundle.

No official partial bundle fits. treemap is only in the full and strict bundles. The map traces are only in the map, strict and full bundles.

Open points before a decision

  1. The build. The custom bundles were made with esbuild and the plotly.js esbuild settings, not with the plotly.js partial-bundle tooling. The custom no-map bundle (1.41 MB) evaluates about 3x faster than the official cartesian bundle (1.50 MB). This difference is not explained. The first draws took the same time (103 ms and 104 ms), so the work does not simply move to the first plot. Build the bundle again with the official tooling and measure again.
  2. Maps. Nobody tested the custom bundle with the map traces.
  3. Warm visits. Only cold visits were measured. On a repeat visit, Chrome can reuse compiled code from its code cache, so the gain can be smaller. Measure a second and a third visit.
  4. The build step. AGENTS.md says that JS has no build step. A custom bundle needs a new build for each Plotly upgrade. Decide where the bundle lives: in the wheel (served by the FlexViz server), or on npm (served by jsDelivr). Notebook pages, share URLs and flexviz report pages must load it too.
  5. Maps on demand. Leaving out the map traces saves about 50 ms more at 1x. It needs a second bundle, and a spec that is imported later (Import, flexvizApply) can add a map figure. The single bundle with maps is probably enough.

Activity

  1. added
    enhancement
    on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions