Run `numba` compilation as a post-install step?
See original GitHub issueCurrently, this is the import performance of sgkit
on a fresh install:
(testenv) benj@benj-X580VD:~$ time python -c "import sgkit"
real 0m16.715s
user 0m16.149s
sys 0m0.987s
(testenv) benj@benj-X580VD:~$ time python -c "import sgkit"
real 0m2.184s
user 0m2.414s
sys 0m0.914s
It might be possible to move the 14s of numba
compilation to a post-install step, hopefully on pip
and conda
.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
A ~5 minute guide to Numba — Numba 0.50.1 documentation
In this mode Numba will identify loops that it can compile and compile those into functions that run in machine code, and it...
Read more >Compiling Python code with @jit - Numba documentation
Code running with the GIL released runs concurrently with other threads executing Python or Numba code (either the same compiled function, or another...
Read more >What is Numba? | Data Science | NVIDIA Glossary
Numba is an open-source, just-in-time compiler for Python code that developers ... replacing the Python interpreter, running a separate compilation step, ...
Read more >Supercharging NumPy with Numba - Towards Data Science
The compilation of a function happens separately before code execution producing an on-disk binary object. Loop Jitting A subset of the function ...
Read more >basics - Jupyter Notebook - MyBinder
Numba is a just-in-time compiler of Python functions. It translates a Python function when it is called into a machine code equivalent 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
I had another look at this. The numba compilation is actually from
guvectorize
, notjit
, since the latter is lazy. I don’t thinkguvectorize
can be made lazy since you have to specify the signatures up front.I think the simplest way forward would be to move all the
guvectorize
functions to separate modules and then import them from the functions that need them. This works since none of theguvectorize
functions are in the public API.So for
popgen.py
, for example, we could move a function like_divergence
which is decorated with numba_guvectorize topopgen_accelerate.py
(or similar), and then the publicdivergence
function would import_divergence
in the function body. Compilation would happen the first timedivergence
is called (not imported).Another thing to try might be lazy compilation instead of the eager compilation (with types specified) that we use everywhere.