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

Rendering performance drop regarding dynamic layout control in template #4976

Closed
TheoMathurin opened this issue May 30, 2023 · 7 comments
Closed
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@TheoMathurin
Copy link
Contributor

TheoMathurin commented May 30, 2023

ALL software version info

Panel 1.0.3
Bokeh 3.1.1
Ubuntun 22.04 and Fedora 38
Latest Firefox/Chromium

Description of expected behavior and the observed behavior

I have a large, complex app that I am very happy to update to Panel 1.0 and Bokeh 3.

After launching it with the necessary adaptations, I noticed significant delays in the main callback (+5 seconds compared to 0.14.4) which loads a map and adapts the widgets on screen. Upon inspection I figured it was linked to events like layout.append(widget).

Edit: this only happens in a template

Complete, minimal, self-contained example code that reproduces the issue

You can compare the performance using the following code on Panel 1.0.3 v Panel 0.14.4. As you add more widgets, you will notice the additional time it takes to render is quite noticeable.

With 100 widgets on screen on my laptop, rendering takes ~3s on Panel 1.0.3 and ~0.5 on Panel 0.14.4. It is not as dramatic as what I observe in my app but the app layout is more complex, although I'm far from having 100 components on screen.

import panel as pn
pn.extension()


def callback(_):
    column.append(pn.widgets.MultiChoice(options=list('ABCDE')))
    nwidgets.object = str(len(column))
    print(nwidgets.object)


column = pn.Column()
button = pn.widgets.Button(name='Click')
nwidgets = pn.pane.Markdown('0')
content = [button, nwidgets, column]
button.on_click(callback)

template = pn.template.VanillaTemplate(main=content)
template.servable()
@TheoMathurin TheoMathurin changed the title Rendering performance drop when dynamically adding widgets to layout on Panel 1.0 Rendering performance drop regarding dynamic layout control on Panel 1.0 May 30, 2023
@philippjfr
Copy link
Member

Thanks for reporting, we'll investigate asap and expedite a fix.

@philippjfr
Copy link
Member

Cannot reproduce any issue here, when I try, even with a 1000 widgets, the render time is roughly 0.5 seconds.

@hoxbro
Copy link
Member

hoxbro commented May 31, 2023

I can't recreate it either (even with the added button). Do you have any special environment variables set?

@hoxbro hoxbro closed this as completed May 31, 2023
@hoxbro hoxbro reopened this May 31, 2023
@TheoMathurin
Copy link
Contributor Author

TheoMathurin commented May 31, 2023

Sorry I reverted the example code to the original version I posted: it turns out the issue only happens in a template. Just tried on a clean 1.0.3 install.

@TheoMathurin TheoMathurin changed the title Rendering performance drop regarding dynamic layout control on Panel 1.0 Rendering performance drop regarding dynamic layout control in template May 31, 2023
@hoxbro
Copy link
Member

hoxbro commented May 31, 2023

Yep. That seems to have done the trick.

@hoxbro hoxbro added the type: bug Something isn't correct or isn't working label May 31, 2023
@philippjfr
Copy link
Member

Suspect the theme/designs must be triggering some recursive recomputation.

@philippjfr
Copy link
Member

Seeing about 140-200 ms timings now with Bokeh 3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

3 participants