Open rozyczko opened 2 years ago
Analysis with py-spy.
Total startup time: 9.28s, out of which:
easyCore\easyCore\__init__.py:11
import pint
takes 2.20s
easyCore\easyCore\Fitting\__init__.py:11
from lmfit import Parameter as lmParameter, Parameters as lmParameters, Model as lmModel
takes 1.41s
easyCore\easyCore\Fitting\fitting_template.py:15
from scipy import stats
takes 1.04s
cryspy\cryspy\A_functions_base\function_3_mcif.py:718
read_magnetic_data()
takes 3.78s
Total of above 4 calls/imports is 8.43s constituting 91% of the startup time
This startup analysis file should be opened by the speedscope app: https://www.speedscope.app/
On average, importing cryspy takes 4.25s while GSASII takes about 1.5s (locally).
It would be good to replace the calculator check in easyDiffractionLib\easyDiffractionLib\Interfaces\__init__.py
with a check that does not directly import those modules. However, this check also does quite a bit of setting up the interfaces, so it won't be as easy. Postponing the actual calculator import, e.g. in Calculators\cryspy.py:7
would also be an option.
Loading cryspy
can't be made lazy since the calculators are all instantiated on startup.
Similarly, lazy loading of lmfit
and pint
can't be easily achieved due to immediate instantiation.
The only module which can be shifted to on-demand load is bumps
and scipy
. This should shave a couple of seconds off the loading time.
Also, improved performance by making the profile update run only once for
This should be helpful
eDA startup is very long. It should be time profiled and optimized.