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

perf: allow the layout of the dom widget to be None #3592

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

maartenbreddels
Copy link
Member

This causes 1 less widget to be created, which matters when you care about performance.
For instance, creating 100 buttons will now create 300 widgets (button, layout and style).
With this change, we only create 200 widgets (button and style). The frontend already supported this, this only enables it in the Python kernel.

Note that the layout is a widget with many traits, causing a significant overhead from traitlets.

I don't think this is a breaking change and can also be backported to 7.x.

@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch maartenbreddels/ipywidgets/feat_allow_layout_dom_widget_none

This causes 1 less widget to be created, which matters when you care
about performance.
For instance, creating 100 buttons will now create 300 widgets
(button, layout and style).
With this change, we only create 200 widgets (button and style).
The frontend already supported this, this only enables it in the
Python kernel.
@maartenbreddels maartenbreddels force-pushed the feat_allow_layout_dom_widget_none branch from 0687d8d to 0dbe32c Compare September 15, 2022 07:39
@jasongrout
Copy link
Member

jasongrout commented Sep 16, 2022

I think this warrants a bump in the model version for base and core controls to 2.1.0, right? This would signify it is backwards compatible, but that it is a change to the model spec.

Also, to be clear, by default you wouldn't see these speed gains. You would only see them if you explicitly set the layout to None, right? In other words, by default we create a Layout widget for you.

export const JUPYTER_WIDGETS_VERSION = '2.0.0';

export const JUPYTER_CONTROLS_VERSION = '2.0.0';

__jupyter_widgets_base_version__ = '2.0.0'
__jupyter_widgets_output_version__ = '1.0.0'
__jupyter_widgets_controls_version__ = '2.0.0'

@jasongrout jasongrout added this to the 8.1 milestone Sep 16, 2022
@maartenbreddels
Copy link
Member Author

I think this warrants a bump in the model version for base and core controls to 2.1.0, right? This would signify it is backwards compatible, but that it is a change to the model spec.

I agree, also output since it inherits from DOMWidget.

by default you wouldn't see these speed gains. You would only see them if you explicitly set the layout to None, right? In other words, by default we create a Layout widget for you.

Correct.

@maartenbreddels maartenbreddels force-pushed the feat_allow_layout_dom_widget_none branch from d7e76c6 to f5f11ea Compare September 20, 2022 17:37
maartenbreddels added a commit to maartenbreddels/ipyvue that referenced this pull request Sep 21, 2022
See jupyter-widgets/ipywidgets#3592

This allows us to do this earlier, without having to depend on the
latest ipywidgets.
maartenbreddels added a commit to maartenbreddels/ipyvue that referenced this pull request Sep 21, 2022
See jupyter-widgets/ipywidgets#3592

This allows us to do this earlier, without having to depend on the
latest ipywidgets.
maartenbreddels added a commit to maartenbreddels/ipywidgets that referenced this pull request Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants