brisvag / blik

Python tool for visualising and interacting with cryo-ET and subtomogram averaging data.
https://brisvag.github.io/blik/
GNU General Public License v3.0
23 stars 8 forks source link

Import times are SLOW #89

Closed brisvag closed 3 years ago

brisvag commented 3 years ago

Something about importing the package is very slow. Some profiling is needed, I'm sure there are improvements to be made, There's probably a lot of messy nested imports that could be prevented.

alisterburt commented 3 years ago

Excessively slower than importing napari?

brisvag commented 3 years ago

I guess you're right... I tried to do some profiling a few weeks back, but maybe I misunderstood the causes. If some dependencies are already imported (especially napari) things are faster

In [1]: %time import numpy
CPU times: user 103 ms, sys: 9.95 ms, total: 113 ms
Wall time: 112 ms

In [2]: %time import pandas
CPU times: user 231 ms, sys: 53.5 ms, total: 284 ms
Wall time: 284 ms

In [3]: %time import napari
CPU times: user 1.21 s, sys: 96.4 ms, total: 1.3 s
Wall time: 1.31 s

In [4]: %time import peepingtom
CPU times: user 400 ms, sys: 43.3 ms, total: 443 ms
Wall time: 443 ms

as opposde to:

In [1]: %time import peepingtom
CPU times: user 1.69 s, sys: 203 ms, total: 1.89 s
Wall time: 1.9 s

Still, I'm sure there are wayt to lazyfying some of these imports.

brisvag commented 3 years ago

I think we can consider this closed by #113 .