Add config/CLI option to select a single slider mode#2286
Open
Neal006 wants to merge 2 commits into
Open
Conversation
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.
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. |
Collaborator
|
@Neal006 we will review when bandwidth allows, hopefully during next week. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tomainonce #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 usersonly ever use one mode. That's the dominant remaining share of slider
payload after #2285.
Fix
SliderModeenum (BOTH,LINEAR_TIME,SIMULATION_STEPS) onFigureProperties.slider_mode, defaultBOTH(unchanged behavior).plot_torax --slider_modeCLI flag that overrides the config value._build_sliderbuilds only that steplist and skips the
updatemenustoggle and its annotation entirely —not deduplicated, fully removed.
Measured (rampup reference dataset)
BOTH(default, unchanged)LINEAR_TIME/SIMULATION_STEPS-65% when a single mode is selected, on top of #2285's static-payload
cut.
Tests
Added
SliderModeSelectionTest(parameterized over both single modes):confirms
updatemenusis empty and figure JSON shrinks vs.BOTH. Fullplotting suite: 238/238 passing.