-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
Delay bleach import to optimise import time #6165
Comments
Seems very sensible, yes. |
Could it be the bytecode file (.pyc) generation? |
No. The |
Got you, that's pretty bizarre indeed. Does sound like a security scan type thing. |
Based on my timing |
Wow. That is a lot. |
31 ms or the timings reported above? |
31ms for something only used in edge cases is a lot. |
I wouldn't call it an edge case, it's used for all HTML, Markdown and ReactiveHTML based components. |
Sorry guess for HTML/Markdown it is behind the sanitize parameter and therefore indeed an edge case but ReactiveHTML is not an edge case. |
Even though it is not an edge case for ReactiveHTML, I still think we should not do any imports unless they are absolutely necessary. For a hvplot-only user, it does not make any sense that Bleach is imported. I also think this will make it possible to remove it from the build packages. |
I'm looking a bit into why Python and Panel imports and startup are slow on my Macbook M1 and hacking on Panel apps I have a slow edit - run cycle. I get weird results unrelated to Panel, even
import pandas
sometimes takes 10-20 seconds and then on further executions just 0.7 seconds - maybe file caching or antivirus or something else - I haven't been able to identify the problem yet.However, using tuna and these commands:
I see that a few percent of the Panel import time is from
panel/panel/util/__init__.py
Line 26 in 46e0639
where you import https://pypi.org/project/bleach/
Is it feasible / advisable to delay that import and only do it if needed, which I presume is if someone creates a HTML pane with non-default
sanitize_html=True
?The text was updated successfully, but these errors were encountered: