Repository navigation
Conversation
Every wrapper in a re-rendered callback subtree dispatched resetComponentState, and each dispatch re-ran every wrapper's selector, so updates were O(n^2) in the subtree size (#4121). Skip the dispatch when no hash is under the path, and match whole path segments so resetting children,1 no longer clears children,10. The benchmark missed this because full_children_replace was written off as slow by design with a 12 s ceiling. Tighten it, add a growth gate and a rerender_existing_subtree scenario, and drop its stale baseline entry.
|
Contributor
Dash performance benchmarks✅ all within thresholds
growth = late-third / early-third per-op time; ~1 is flat, a large value means the per-op cost scales with accumulated state. machine scale vs baseline: 0.98x - divided out of the baseline ratios so they compare like for like (the absolute warn/fail ceilings are left un-scaled); calibrated on |
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.



Fixes #4121.
Since #3570, every wrapper in a re-rendered callback subtree dispatched
resetComponentStatefrom its_newRendereffect, and each dispatch re-runs every mounted wrapper's selector. Re-rendering a subtree was O(n^2) in its size: 400 rows (1200 components) took 1219 store updates per click.Renderer
resetDescendantHashesonly dispatches the reset when alayoutHasheskey is at or under the wrapper's path. With no hashes to clear the old dispatch only produced an equal copy of the state, so nothing changes except the extra notification.children,1no longer clearschildren,10.Benchmarks
full_children_replacealready showed this (p90 4.7 s, growth 16x) but was written off as "O(total) by design" with a 12 s fail ceiling. It is linear once fixed.full_children_replaceto warn 400 ms / fail 1500 ms.max_growthgate: fail when per-click cost grows faster than the workload. Linear is ~3x here, the bug was 16-20x.rerender_existing_subtree: re-renders the same-size subtree each click, the case from the issue. The existing scenario mostly creates new components, which the [BUG] dbc Tabs not showing default first tab anymore with Dash 4.2.0 and higher #3929 first-render guard skips.full_children_replacebaseline entry. After merge, run theregenerate_baselinedispatch to measure both scenarios on CI.full_children_replacep90 / growthrerender_existing_subtreep90Both scenarios fail on the old renderer and pass with the fix (local runs).
No overlap with #4055 or #3984. #4103 touches other sections of
scenarios.pyand.ai/PERFORMANCE.md; only the CHANGELOG[UNRELEASED]header will conflict.Contributor Checklist
dev(fix or chore) ornext(feature, new API, breaking change), see Which branch to targettest_rdraw005counts store updates per re-render (319 before, under 40 after)layoutHashes.test.jscovers the reducer's segment match and no-op caseoptionals
CHANGELOG.md