Freeze size of heavy nodes when resizing panels#812
Draft
krassowski wants to merge 7 commits into
Draft
Conversation
Member
Author
|
Testing locally using scripted JupyterLab galata benchmarks, we can drop most optimizations apart for dimension freezing: SetupTwo pre-rendered notebooks opened side-by-side (horizontal split):
Measurement: browser Results
|
krassowski
added a commit
to jupyterlab/jupyterlab
that referenced
this pull request
May 19, 2026
## References - Same idea as jupyterlab/lumino#812 - Addresses jupyterlab/lumino#505 but for now in JupyterLab rather than lumino This will allow us to get feedback on this change during the beta cycle, without having to commit to extended API surface in lumino yet. ## Code changes - Adds `optimizeResize` Shell setting - Adds `OptimizedDockPanelSvg` subclass of `DockPanelSvg` - Uses `OptimizedDockPanelSvg` in the `LabShell` ## User-facing changes Resizing is faster. This can be verified by running: ```bash BENCHMARK_NUMBER_SAMPLES=20 jlpm test:benchmark --grep "Notebook Resize" ``` | Mode | n | avg | median | sd | min | max | |-------------|-----|---------|---------|-------|---------|---------| | optimized | 20 | 736 ms | 731 ms | 19 ms | 718 ms | 804 ms | | unoptimized | 20 | 1444 ms | 1440 ms | 16 ms | 1422 ms | 1473 ms | <details> <summary>To recreate table above</summary> ```python import json, statistics data = json.load(open('~/jupyterlab/galata/benchmark-results/lab-benchmark.json')) by_mode = {} for r in data['values']: by_mode.setdefault(r['file'], []).append(r['time']) for name, times in sorted(by_mode.items()): n = len(times) avg = sum(times)/n med = statistics.median(times) sd = statistics.stdev(times) print(f'{name}: n={n} avg={avg:.0f}ms median={med:.0f}ms sd={sd:.0f}ms min={min(times):.0f}ms max={max(times):.0f}ms') ``` </details> ### Before [Screencast From 2026-04-21 15-21-43.webm](https://github.com/user-attachments/assets/2776d939-209a-4313-a214-73d057d24fbb) ### After [Screencast From 2026-04-21 15-11-26.webm](https://github.com/user-attachments/assets/b7550824-f4fe-4ff2-8570-c34bdb0caafc) ## Backwards-incompatible changes None ## AI usage - **Yes**: Some or all of the content of this PR was generated by AI. - **Yes**: The human author has carefully reviewed this PR and run this code (keep this PR "draft" until the answer is YES) - AI tools and models used: Claude Code, Codex --------- Co-authored-by: Darshan Poudel <pranishpoudel10@gmail.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.
Description
Trigger condition
longtaskorlong-animation-framebut it comes after user already saw a freeze for a few seconds; I think this is not the right approach - the Performance API was designed primarily as a measurement tool, not to make the rendering system reactive.Freeze implementation
contain: strictalone is not enough because it tells the layout engine that when considering layout of parents it can use the size as given inwidth/heightbut the browser still needs to relay all the text nodes inside the widget, which is more expensiveminWidth/maxWidthon the widgets with many children; it works but it is still not as fast as it could be; we know that it could be faster because resizing the same panels top-down is super smooth (without tricks) since we enabled strict containment. I believe that the difference is that the leaf layout, including text reflow, is never touched in top-down resize because the content is just scrolled rather than re-laidcontent-visibility: autoto DOM children of heavy widgets, I am yet to confirm if this is warranted in the final formFreezing the width means that the
Widgetin panels which haveoverflow: autoenabled get scrollbars, which you can see on the recordings below.Throttled/delayed updates
Before
Screencast.From.2026-04-21.15-21-43.webm
After (active on pointer down, no long animation frame detection)
Screencast.From.2026-04-21.15-11-26.webm
After (activates only after long frame/task detection)
Screencast.From.2026-04-21.14-52-24.webm