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

BokehJS leak a lots style tag in head tag cause a slow performance #10072

Closed
rwayan opened this issue May 26, 2020 · 1 comment · Fixed by #10073
Closed

BokehJS leak a lots style tag in head tag cause a slow performance #10072

rwayan opened this issue May 26, 2020 · 1 comment · Fixed by #10073

Comments

@rwayan
Copy link

rwayan commented May 26, 2020

I am using this simple code to show this promblem

import panel as pn
import holoviews as hv
import numpy as np
import pandas as pd
import datetime
from streamz.dataframe import DataFrame as sDataFrame



pn.extension()

df = sDataFrame(example=pd.DataFrame({'y': []}, index=pd.DatetimeIndex([])))
def line_plot(data):
    return hv.Table(pd.concat(data[0:10]))
altair_stream = df.cumsum().stream.sliding_window(50).map(line_plot)
def emit():
    df.emit(pd.DataFrame({'y': [np.random.randn()]}, index=pd.DatetimeIndex([datetime.datetime.now()])))

altair_pane = pn.pane.Streamz(altair_stream, height=350, always_watch=True)
altair_pane.add_periodic_callback(emit, period=100)
col = pn.Column(altair_pane)
col.servable()

from the beginning it running very well in normal performance, and then after serveral minutes later
it be come very low performance.

then i saw a lots of tags like

<style type="text/css" rel="stylesheet">.slickgrid_298815 .slick-header-column { left: 1000px; } .slickgrid_298815 .slick-top-panel { height:25px; } .slickgrid_298815 .slick-preheader-panel { height:25px; } .slickgrid_298815 .slick-headerrow-columns { height:25px; } .slickgrid_298815 .slick-footerrow-columns { height:25px; } .slickgrid_298815 .slick-cell { height:20px; } .slickgrid_298815 .slick-row { height:25px; } .slickgrid_298815 .l0 { } .slickgrid_298815 .r0 { } .slickgrid_298815 .l1 { } .slickgrid_298815 .r1 { }</style>

in head tag

it will cause the bad performance.
when I try to delete all of them

for (let i = document.head.children.length - 2 ; i >=0 ; i--) { if (document.head.children[i].attributes[1].name == "rel" && document.head.children[i].attributes[1].value == "stylesheet") {document.head.children[i].remove();}}

the numbers jump become faster

Please Help to fix about this @MarcSkovMadsen @philippjfr @mattpap
when rebuild , the style tag not deleted left in head , cause performance problem.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants