Skip to content

[seaborn-] skip slow imports on every plot after the first plot#3106

Merged
saulpw merged 1 commit into
saulpw:developfrom
midichef:seaborn_imports
May 23, 2026
Merged

[seaborn-] skip slow imports on every plot after the first plot#3106
saulpw merged 1 commit into
saulpw:developfrom
midichef:seaborn_imports

Conversation

@midichef

Copy link
Copy Markdown
Contributor

This PR speeds up plots using Seaborn.

The imports of matplotlib.pyplot and seaborn were being done fresh on every call to plot*-ext, instead of just the first call. On my system that added a delay of about 2 seconds each time. After this PR the delay only happens on the first call.

@saulpw

saulpw commented May 23, 2026

Copy link
Copy Markdown
Owner

vd.importExternal should be caching the package, just like how import does, so subsequent re-imports should take no time at all. Rather than manually caching it, let's fix vd.importExternal properly.

@midichef

Copy link
Copy Markdown
Contributor Author

importExternal currently is caching the packages, but it's doing so inside the spawned process, where ext_plot_seaborn is run with multiprocessing. The next spawned Seaborn process can't see those cached packages.

@saulpw

saulpw commented May 23, 2026

Copy link
Copy Markdown
Owner

I see, sorry for not reading more carefully. Thanks for submitting this!

@saulpw saulpw merged commit 65b8321 into saulpw:develop May 23, 2026
12 checks passed
@midichef midichef deleted the seaborn_imports branch May 24, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants