Feature request: faster import
See original GitHub issueIs your feature request related to a problem? Please describe.
It’s very slow to import sfaira
. This includes any use of the command line interface. For example:
$ time sfaira --help
...
sfaira --help 28.27s user 1.04s system 106% cpu 27.624 total
%time import sfaira
Describe the solution you’d like
Faster import of Sfaira by delaying computation of whatever is taking so long.
Additional context
It looks to me like this is mostly coming from this line:
and the subsequent loading of a bunch of ontologies. Here’s the first couple lines of %prun -s cumtime import sfaira
for evidence that this is the culprit:
46387199 function calls (46339180 primitive calls) in 33.690 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
276 0.005 0.000 38.698 0.140 __init__.py:1(<module>)
7 0.001 0.000 33.802 4.829 __init__.py:2(<module>)
4477/1 0.029 0.000 33.693 33.693 {built-in method builtins.exec}
3377/1 0.014 0.000 33.693 33.693 <frozen importlib._bootstrap>:986(_find_and_load)
3364/1 0.010 0.000 33.693 33.693 <frozen importlib._bootstrap>:956(_find_and_load_unlocked)
3166/1 0.011 0.000 33.693 33.693 <frozen importlib._bootstrap>:650(_load_unlocked)
2975/1 0.006 0.000 33.693 33.693 <frozen importlib._bootstrap_external>:842(exec_module)
5107/1 0.003 0.000 33.693 33.693 <frozen importlib._bootstrap>:211(_call_with_frames_removed)
1 0.000 0.000 30.572 30.572 ontologies.py:10(__init__)
6 0.000 0.000 29.722 4.954 base.py:551(__init__)
6 0.045 0.008 29.722 4.954 base.py:512(__init__)
6 0.657 0.109 29.677 4.946 read.py:12(read_obo)
6 1.020 0.170 28.010 4.668 read.py:63(get_sections)
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
[Feature Request] Allow direct import of utils ... - GitHub
[Feature Request] Allow direct import of utils.PlotlyJSONEncoder for faster Dash startup time #2174. anders-kiaer opened this issue on Feb 10, ...
Read more >Best practices to increase the speed for Next.js apps
Following these best practices will help you take advantage of those features so you can start building faster Next.js applications. Tags: next.
Read more >[Feature Request] Sketcher: Importing an edge from another ...
Re: [Feature Request] Sketcher: Importing an edge from another body. A couple features that could have made the process a little faster: 2D ......
Read more >Want Faster HTTP Requests? Use A Session with Python!
It comes with many benefits and lets us access more features within the requests library, the most common and used Python library for...
Read more >Feature Request: Import Instrument Lists with Exchanges.
Please can I submit a feature request to enable instrument lists to ... but hoping this is an easier/faster to implement request that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We could keep the OCS constant but only populate it with the intialised ontologies based on a particular function call,
sfaira.initialise()
for example.https://github.com/theislab/sfaira/commit/c26c0dbbbcf07cc82169a960a70ea6f88595af64
@davidsebfischer CLI startup is now in the order of 1-2 seconds. Can’t improve it much further as long as TensorFlow is involved.