-
Notifications
You must be signed in to change notification settings - Fork 947
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
base: main
Are you sure you want to change the base?
perf: allow the layout of the dom widget to be None #3592
Conversation
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.
0687d8d
to
0dbe32c
Compare
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.
ipywidgets/python/ipywidgets/ipywidgets/_version.py Lines 10 to 12 in 6330485
|
I agree, also output since it inherits from DOMWidget.
Correct. |
d7e76c6
to
f5f11ea
Compare
See jupyter-widgets/ipywidgets#3592 This allows us to do this earlier, without having to depend on the latest ipywidgets.
See jupyter-widgets/ipywidgets#3592 This allows us to do this earlier, without having to depend on the latest ipywidgets.
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.