voila icon indicating copy to clipboard operation
voila copied to clipboard

Performance: voila takes double the time to create widgets compared to Notebook

Open maartenbreddels opened this issue 4 years ago • 13 comments

Creating ~600 widgets using:

import ipywidgets as widgets
def recursive(n):
    if n == 0:
        return widgets.Button(description='Hi')
    else:
        cls = (widgets.VBox if n % 2 else widgets.HBox)
        return cls([recursive(n-1), recursive(n-1)])
recursive(7)

Takes about 1.5-2.0 seconds to display in the notebook, while it takes over 4.0 seconds using Voila.

I think at least one problem lies in the way we update the widgets / sync the state. We ask each widget/comm separately for an update, which causes a 'busy', 'update' and 'idle' message, 3x more than needed. This causes in total 1800 websocket messages. I am also not sure why that seems so slow.

maartenbreddels avatar Nov 16 '20 14:11 maartenbreddels

https://github.com/jupyter/jupyter_client/pull/590 takes off 50% of the time. ~2.8 to ~1.8 seconds

maartenbreddels avatar Nov 17 '20 13:11 maartenbreddels

The 4 seconds mentioned above was with Chrome with the dev console open.

maartenbreddels avatar Nov 17 '20 13:11 maartenbreddels

Minor contributor (few %): https://github.com/ipython/traitlets/pull/638

maartenbreddels avatar Nov 17 '20 15:11 maartenbreddels

https://github.com/tornadoweb/tornado/pull/2955 is another 80msec per 1000 messages.

maartenbreddels avatar Nov 17 '20 16:11 maartenbreddels

adding --Session.key= avoid signing of messages, which also takes off a few %.

maartenbreddels avatar Nov 17 '20 16:11 maartenbreddels

https://github.com/jupyter-widgets/ipywidgets/pull/3020 and https://github.com/ipython/traitlets/pull/639

scrape of 30%

maartenbreddels avatar Nov 19 '20 10:11 maartenbreddels

A 5x improvement might be possible based on https://github.com/voila-dashboards/voila/pull/766 and https://github.com/jupyter-widgets/ipywidgets/pull/3021

maartenbreddels avatar Nov 19 '20 11:11 maartenbreddels

@maartenbreddels is this issue still valid with #933 now merged and released in 0.2.11?

jtpio avatar Sep 02 '21 12:09 jtpio

Hi everyone, I've tested this with Voilà 0.2.16 and I can confirm the issue is still valid. Rendering the snippet above with voilà is taking at least twice more time.

pierrotsmnrd avatar Nov 19 '21 08:11 pierrotsmnrd

Things should be improved with the coming ipywidgets release and https://github.com/voila-dashboards/voila/pull/766

martinRenou avatar Nov 19 '21 09:11 martinRenou

Hi everyone :) Any update on this issue and the next ipywidgets release ? FYI I've tested again with Voilà 0.3.0 and the issue still occurs (logically)

pierrotsmnrd avatar Dec 15 '21 16:12 pierrotsmnrd

@pierrotsmnrd The release plans of ipywidgets 8 can be tracked here: https://github.com/jupyter-widgets/ipywidgets/issues/2750

vidartf avatar Dec 20 '21 15:12 vidartf

Thanks a lot @vidartf, that's exactly what I was looking for.

pierrotsmnrd avatar Dec 20 '21 15:12 pierrotsmnrd

This is fixed now with #766 and recent ipywidgets releases

martinRenou avatar Oct 28 '22 07:10 martinRenou