Skip to content

Significant performance degradation for plotly in 0.8.0 #239

@alinacherkas

Description

@alinacherkas

Hi! I noticed that the rendering speed for plotly has significantly deteriorated in 0.8.0. Here is a simple app:

import plotly.express as px
from shiny import App, render, ui
from shinywidgets import render_widget, output_widget

app_ui = ui.page_fluid(
    ui.panel_title("Hello Shiny!"),
    ui.input_slider("n", "N", 0, 100, 20),
    ui.output_text_verbatim("txt"),
    ui.layout_columns(
        output_widget("barchart"),
        output_widget("scatter"),
    ),
)


def server(input, output, session):
    @render.text
    def txt():
        return f"n*2 is {input.n() * 2}"

    @render_widget
    def barchart():
        df = px.data.medals_wide()
        fig = px.bar(
            df, x="nation", y=["gold", "silver", "bronze"], title="Wide-Form Input"
        )
        return fig

    @render_widget
    def scatter():
        df = px.data.tips()
        fig = px.scatter(
            df,
            x="total_bill",
            y="tip",
            color="smoker",
            facet_col="sex",
            facet_row="time",
        )
        return fig


app = App(app_ui, server)

In 0.7.2, the figures appear almost instantly, but in 0.8.0 it takes quite a few seconds before anything is displayed. I guess the issue was introduced in #236 . Tested with:

shiny~=1.6.1
shinywidgets~=0.7.2/0.8.0
plotly[express]~=6.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions