Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizing of panels is slow when there are many nodes in resized notebooks/widgets #505

Open
krassowski opened this issue Dec 27, 2022 · 1 comment
Labels
bug Something isn't working help wanted Please work on this if you are interested performance Addresses performance

Comments

@krassowski
Copy link
Member

Description

Resizing split/dock panels is slow. #504 proposes a solution for bottom-down resizing which is specific to Chrome.

Reproduce

As in #504 but left-right.

Expected behavior

Resizing does not jitter the UI allowing users to precisely set the layout they need at a first attempt.

Proposed solution

When we start the drag action of a SplitPanel we could throttle the relayout of the contents.
This requires isolating the contents of the panel to preserve its layout by pinning width and height, adding contain:strict and then updating the width/height every once in a while to match the size of the outer container.

There is a trade-off: throttling the contents updates would mean that contents are sometimes out of sync with the container size. Some applications deal with this by stretching the contents in compositor (using transform: scale) but it only looks good if the content has little text and resizes proportionally rather than reflowing.

Ideally we would be able to only isolate the problematic elements. With windowed notebook in 4.x we are not concerned about the notebook having many cells but about cells having large outputs*, e.g. an SVG with 1000s elements ; if we could contain the SVG size (throttle its updates) for the time of resizing, the UX would be much nicer as the overall layout of notebook would still reflow smoothly.

Technically we would need to implement a special method in split panel children to handle requests:

  • "isolate large elements" (invoked by SplitPanel when user starts resizing)
  • "update size of isolated elements" (invoked by SplitPanel with throttling on mousemove when resizing)

*) or by individual cells having incredibly long code, say thousands of lines

@krassowski krassowski added bug Something isn't working status:Needs Triage performance Addresses performance and removed status:Needs Triage labels Dec 27, 2022
@krassowski krassowski added the help wanted Please work on this if you are interested label Jan 8, 2023
@vidartf
Copy link
Member

vidartf commented Mar 8, 2023

An alternative to throttling the relayout is to replace the content of a node with a placeholder image (not a screenshot but a generic "ui element here" image). We might also be able to only do this conditionally if we detect that layout events are slow (e.g. we are resizing a panel, and start updating layout as we go. This assumes that we can know when the layout has completed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Please work on this if you are interested performance Addresses performance
Projects
None yet
Development

No branches or pull requests

2 participants