Speed fixes from the integration branch: section key, controls test, parked cards - #503
Open
christophsax wants to merge 4 commits into
Open
christophsax wants to merge 4 commits into
christophsax wants to merge 4 commits into
Conversation
reported_sections() tested "collapse_blk_sections" %in% names(input). names() on a module's input depends on the session's whole name set, so every new input anywhere on the board invalidated every block's `visible`, and freeze_hidden_inputs(), which reads all of them, redid the whole board per card mount: 21 to 43 runs over ~90 blocks on a first view visit. The read of input$collapse_blk_sections above already fires when the key first appears, even as NULL, so the key test needs no dependency of its own.
has_expr_ui() runs twice per block and only needs to know whether the expression UI renders any markup. renderTags() also resolves the UI's html dependencies, which grew with the design-system controls (resolveDependencies 0.34 s -> 1.43 s over a short session). doRenderTags() gives the same markup without that step.
The offcanvas pools that hold the cards and extensions of views not on screen were only visibility: hidden, so the browser kept styling and laying out every parked card. On a 90-block board, after visiting all ten views, that is 10,304 of 19,996 elements. content-visibility: hidden on the closed pool skips the work; sizes stay readable, so Shiny keeps the outputs unsuspended and charts get no resize to zero (display: none would do both). Same-page A/B on that board, loaded container, 8 switches per arm: one DOM insertion 106 -> 11 ms, style per return switch 2.1 -> 0.8 s, main-thread task 2.7 -> 1.8 s.
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 1, 2026
This branch has not been deployed
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.
@nbenn, these come from the integration branch (
integration/devmaster-latest), where we have been trying out speed fixes on a demo board with about 90 blocks and ten views. The integration board feels noticeably snappier, and these are the dock parts of that, rebased onto main. They do not depend on the design-system PRs. Take what is useful; the three commits are independent, so dropping or splitting any of them is fine.isolate()(R/plugin-block.R).reported_sections()tested"collapse_blk_sections" %in% names(input).names()on a module's input depends on the session's whole input name set, so every new input anywhere on the board invalidated every block'svisible, andfreeze_hidden_inputs()re-read all of them per card mount: 21 to 43 runs over ~90 blocks on a first view visit, 1.2 to 6 s. After: 9 to 16 runs, 0.3 to 0.9 s. The unconditional read ofinput$collapse_blk_sectionsabove it already takes the dependency that fires when the key first appears.R/block-ui.R).has_expr_ui()only needs to know whether the expression UI renders any markup.doRenderTags()gives the same markup asrenderTags()without resolving the html dependencies, which cost more than the markup once every control carried its own set:resolveDependencies1.4 to 0.8 s over a short session.blockr-dock.css). The offcanvas pools that hold cards and extensions of views not on screen were onlyvisibility: hidden, so the browser kept styling and laying out every parked card: half the document once all views have been visited.content-visibility: hiddenon the closed pool skips that work. Unlikedisplay: none, sizes stay readable, so Shiny does not suspend the outputs and charts get no resize to zero. One DOM insertion 106 to 11 ms, style per return view switch 2.1 to 0.8 s.Not included:
initializedreport waits 2 to 4 s behind them on a first view visit. Filed as InputBatchSender sends an empty input message for every deferred setInput() rstudio/shiny#4436, worked around in Skip the empty input messages Shiny sends after deferred inputs blockr.ui#73. Attaching it in the dock is one line inblockr_app_ui.dock_board(), for after that merges.has_required()stopping at the first declared slot (render gates read ~90 slots each).~~ Resolved in core by Fold front-end demand into the one multi-owner claim set blockr.core#337: a render gate now reads the onegatereactive.Together with the blockr.ui change and two small ones in other packages, a scripted session on the demo board went from 37 to 30 s; the first visits to the larger views from 6.9 to 4.9 s and from 8.3 to 6.2 s. All numbers are from a shared container under load, so compare the arms of one measurement rather than across them.
The dock tests pass (8300) against blockr.core, blockr.ui and dockViewR main.