Stop re-fetching every thumbnail on each new plot - #262
Open
r2evans wants to merge 1 commit into
Open
Conversation
Each sidebar thumbnail URL embedded the device-global update counter (upid) as a cache-busting query parameter. Since upid increments on every device update, drawing one new plot changed the URLs of all N thumbnails at once, causing the browser to re-download and the server to re-render the entire plot history on every plot (O(N^2) over a session). This made the client progressively slower as plots accumulated, regardless of plot complexity. Only the newest plot can still change under an unchanged plot id (incremental drawing on the active page), so only its thumbnail now carries the upid cache-buster; older plots are immutable and keep stable URLs that the browser caches. Thumbnails additionally load lazily so off-screen history is not fetched on page load. Measured with ~50 plots in history: drawing one plot previously issued 50+ /plot requests (~16 MB re-rendered and re-downloaded); it now issues a constant 3 regardless of history size. Closes nx10#260 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Each sidebar thumbnail URL embedded the device-global update counter (upid) as a cache-busting query parameter. Since upid increments on every device update, drawing one new plot changed the URLs of all N thumbnails at once, causing the browser to re-download and the server to re-render the entire plot history on every plot (O(N^2) over a session). This made the client progressively slower as plots accumulated, regardless of plot complexity.
Only the newest plot can still change under an unchanged plot id (incremental drawing on the active page), so only its thumbnail now carries the upid cache-buster; older plots are immutable and keep stable URLs that the browser caches. Thumbnails additionally load lazily so off-screen history is not fetched on page load.
Measured with ~50 plots in history: drawing one plot previously issued 50+ /plot requests (~16 MB re-rendered and re-downloaded); it now issues a constant 3 regardless of history size.
Closes #260
As mentioned in #260, this reduces the rendering time back to O(1) regardless of the number of plots in the history.