OpenBB
OpenBB copied to clipboard
[IMPROVE] sdk import takes long time to complete
What's the feature that should be improved? from openbb_terminal.sdk import openbb should not take this long
Describe how you would like the feature improved load faster
Possibly describe the ideal way to improve this find out what is causing the delay
Additional information this is the output from cprofile.run("from openbb_terminal.sdk import openbb") it takes almost 1 minute on my laptop to just import openbb
7771444 function calls (7521605 primitive calls) in 55.540 seconds
Ordered by: cumulative time
List reduced from 24198 to 100 due to restriction <100>
ncalls tottime percall cumtime percall filename:lineno(function)
6143/1 0.209 0.000 55.553 55.553 {built-in method builtins.exec}
6798/1 0.253 0.000 55.553 55.553 <frozen importlib._bootstrap>:1022(_find_and_load)
6322/1 0.092 0.000 55.553 55.553 <frozen importlib._bootstrap>:987(_find_and_load_unlocked)
7743/2 0.020 0.000 55.550 27.775 <frozen importlib._bootstrap>:233(_call_with_frames_removed)
6076/2 0.087 0.000 55.543 27.772 <frozen importlib._bootstrap>:664(_load_unlocked)
5709/2 0.059 0.000 55.543 27.772 <frozen importlib._bootstrap_external>:877(exec_module)
1725/322 0.014 0.000 49.893 0.155 {built-in method builtins.__import__}
7034/3455 0.030 0.000 38.084 0.011 <frozen importlib._bootstrap>:1053(_handle_fromlist)
1 0.000 0.000 33.717 33.717 C:\CODE\openbb\.venv\lib\site-packages\openbb_terminal\__init__.py:1(<module>)
1 0.000 0.000 33.577 33.577 C:\CODE\openbb\.venv\lib\site-packages\openbb_terminal\core\plots\__init__.py:1(<module>)
1 0.000 0.000 32.375 32.375 C:\CODE\openbb\.venv\lib\site-packages\openbb_terminal\core\plots\plotly_helper.py:1(<module>)
6247/6057 0.174 0.000 25.486 0.004 <frozen importlib._bootstrap>:921(_find_spec)
31064 21.978 0.001 21.983 0.001 {built-in method nt.stat}
**1 0.000 0.000 21.822 21.822 C:\CODE\openbb\.venv\lib\site-packages\openbb_terminal\sdk.py:1(<module>)**
28468 0.100 0.000 18.675 0.001 <frozen importlib._bootstrap_external>:140(_path_stat)
**1 0.000 0.000 17.940 17.940 C:\CODE\openbb\.venv\lib\site-packages\statsmodels\api.py:1(<module>)**
I see two major culprit, one is openbb sdk itself, another is statsmodels.api
using python -X importtime -c "from openbb_terminal.sdk import openbb"
with tuna to visualize the import time