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

Debug slow import #507

Closed
cliffckerr opened this issue Jul 27, 2023 · 3 comments
Closed

Debug slow import #507

cliffckerr opened this issue Jul 27, 2023 · 3 comments
Labels
bug Bug or bugfix
Milestone

Comments

@cliffckerr
Copy link
Member

On chinchilla, huge difference

import time; a = time.time(); import sciris; b = time.time() - a; print(b)
1.9605119228363037
import time; a = time.time(); import pandas; import pylab; b = time.time() - a; print(b)
0.5196902751922607

Locally, very little difference

import time; a = time.time(); import sciris; b = time.time() - a; print(b)
0.3653862476348877
import time; a = time.time(); import pandas; import pylab; b = time.time() - a; print(b)
0.30755186080932617
@cliffckerr cliffckerr added the bug Bug or bugfix label Jul 27, 2023
@cliffckerr
Copy link
Member Author

Difference is settings.

Locally:

preliminaries: 2.4080276489257812e-05
sc_version: 0.000415802001953125
sc_utils: 0.1680305004119873
sc_printing: 0.16973400115966797
sc_nested: 0.16983556747436523
sc_odict: 0.1701200008392334
sc_settings: 0.34852123260498047
sc_datetime: 0.3488953113555908
sc_math: 0.3489072322845459
sc_dataframe: 0.34915900230407715
sc_fileio: 0.3539769649505615
sc_versioning: 0.35413599014282227
sc_profiling: 0.35815906524658203
sc_parallel: 0.3593869209289551
sc_asd: 0.3594839572906494
sc_plotting: 0.35982418060302734
sc_colors: 0.36571717262268066

VM:

preliminaries: 8.58306884765625e-06
sc_version: 0.005199432373046875
sc_utils: 0.2072312831878662
sc_printing: 0.21686410903930664
sc_nested: 0.2189188003540039
sc_odict: 0.2300734519958496
sc_settings: 1.8661830425262451
sc_datetime: 1.8760707378387451
sc_math: 1.876101016998291
sc_dataframe: 1.883629322052002
sc_fileio: 1.8940608501434326
sc_versioning: 1.8977737426757812
sc_profiling: 1.9086053371429443
sc_parallel: 1.9134533405303955
sc_asd: 1.9161326885223389
sc_plotting: 1.9199676513671875
sc_colors: 1.9383621215820312

@cliffckerr
Copy link
Member Author

cliffckerr commented Jul 27, 2023

Cause: pl.get_backend() is actually creating the backend. Old solution here:
matplotlib/matplotlib#13096 (comment)

New solution seems to be rcParams._get_backend_or_none().

@cliffckerr cliffckerr added this to the rc3.0.1 milestone Jul 27, 2023
@cliffckerr
Copy link
Member Author

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or bugfix
Projects
None yet
Development

No branches or pull requests

1 participant