assume-framework / assume

ASSUME - Agent-based Simulation for Studying and Understanding Market Evolution
https://assume.readthedocs.io
20 stars 5 forks source link

ASSUME startup time high due to packages like pypsa and torch #318

Closed maurerle closed 4 months ago

maurerle commented 4 months ago

I found that the startup time of assume can be relatively high with multiple seconds. This is due to the time it takes to import packages in python.

pypsa       0.938s
torch       1.4s
pandas      0.262s
pyomo       0.214s
sqlalchemy  0.26s
numpy       0.1s
yaml        0.002s

resulting in 3.3s vs 0.6s of init duration (if pypsa, torch and pyomo is not installed).

There is nothing we can do about it and its not a major issue. Just keep in mind, that it is faster if those two packages are not installed if you do not need them I am just looking into performance generally and wanted to document this here.

maurerle commented 4 months ago

with only needed packages: image

with all packages installed: image

running python3 -X importtime cli.py 2> out.profile and visualizing it with tuna out.profile

maurerle commented 4 months ago

I don't think that there is anything we can do about this. We should focus on the improvements which can be made in #321