Skip to content

Add config/CLI option to select a single slider mode#2286

Open
Neal006 wants to merge 2 commits into
google-deepmind:mainfrom
Neal006:perf/plotly-slider-mode-flag
Open

Add config/CLI option to select a single slider mode#2286
Neal006 wants to merge 2 commits into
google-deepmind:mainfrom
Neal006:perf/plotly-slider-mode-flag

Conversation

@Neal006

@Neal006 Neal006 commented Jul 14, 2026

Copy link
Copy Markdown

Second, isolated speedup for #553 — stacked on #2285 (static-x/vline dedup). This branch is based on perf/plotly-slider-payload, so the diff below includes that PR's commit until #2285 merges; only the second commit ("Add config/CLI option...") is new here — please review that commit in isolation. Will auto-retarget to main once #2285 lands.

Problem

The slider mode toggle ("Plasma time" vs "Simulation steps") always builds
both step lists and embeds both in updatemenus, even though most users
only ever use one mode. That's the dominant remaining share of slider
payload after #2285.

Fix

  • New SliderMode enum (BOTH, LINEAR_TIME, SIMULATION_STEPS) on
    FigureProperties.slider_mode, default BOTH (unchanged behavior).
  • New plot_torax --slider_mode CLI flag that overrides the config value.
  • When a single mode is selected, _build_slider builds only that step
    list and skips the updatemenus toggle and its annotation entirely —
    not deduplicated, fully removed.

Measured (rampup reference dataset)

Mode Figure JSON size
BOTH (default, unchanged) 1.37 MB
LINEAR_TIME / SIMULATION_STEPS 0.48 MB

-65% when a single mode is selected, on top of #2285's static-payload
cut.

Tests

Added SliderModeSelectionTest (parameterized over both single modes):
confirms updatemenus is empty and figure JSON shrinks vs. BOTH. Full
plotting suite: 238/238 passing.

Neal006 added 2 commits July 14, 2026 11:03
Slider steps re-sent the static rho-grid x-arrays for every spatial
trace at every timestep, and timestamp vlines were traces whose x/y
were restyled per step. x-arrays are now set once on the traces, and
the vlines are layout shapes moved via the relayout part of the
slider 'update' method.

Figure JSON size: -31% on a 106-step basic_config run (4.2->2.9 MB),
-28% on iterhybrid_rampup. No visual change.

Addresses part of google-deepmind#553.
Slider mode toggle (Plasma time / Simulation steps) always embedded
both step lists plus a dropdown, doubling slider payload for users
who only ever use one mode. FigureProperties.slider_mode (and the new
plot_torax --slider_mode flag) now lets callers pick a single mode
and drop the toggle and second step list entirely; default (BOTH)
keeps existing behavior unchanged.

Figure JSON size on iterhybrid_rampup: 1.37 MB (BOTH, unchanged) ->
0.48 MB (single mode), -65%.

Addresses the remaining part of google-deepmind#553, on top of google-deepmind#2285.
@Neal006

Neal006 commented Jul 18, 2026

Copy link
Copy Markdown
Author

@jcitrin , just checking up on updates regarding the PR approval. If there are any changes that you need me to do, I'm happy to do it.

@jcitrin

jcitrin commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

@Neal006 we will review when bandwidth allows, hopefully during next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants