nitrocalcite / ivfit

Perform interactive 1d fitting with lmfit & bokeh
Apache License 2.0
0 stars 0 forks source link

Initial import time is quite long #5

Open caldwellshane opened 3 years ago

caldwellshane commented 3 years ago

Haven't dug any deeper but the first

>>> import ivfit

on a fresh build is about 15 seconds. Maybe keeping an eye out for a way to shorten this as it will impact the CI pipeline of this project and downstream.

nitrocalcite commented 3 years ago

On a installed copy fresh from the use-poetry branch, that only takes 1 second for me in ipython...

In [1]: %timeit -n 1 -r 1 import ivfit
1.06 s ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

The breakdown seems to be half panel and half lmfit:

In [1]: %timeit -n 1 -r 1 import bokeh
21.5 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

In [2]: %timeit -n 1 -r 1 import panel
627 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

In [3]: %timeit -n 1 -r 1 import lmfit
524 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

In [4]: %timeit -n 1 -r 1 import ivfit
12 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

This is on Windows, is there some other caching mechanism I should be aware of?

caldwellshane commented 3 years ago

I'm not aware of any specific caching mechanisms. It could also be a difference in how the envs are built, maybe?

On Mon, Apr 19, 2021 at 8:42 AM Jonathan Okasinski @.***> wrote:

On a installed copy fresh from the use-poetry branch, that only takes 1 second for me in ipython...

In [1]: %timeit -n 1 -r 1 import ivfit

1.06 s ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

The breakdown seems to be half panel and half lmfit:

In [1]: %timeit -n 1 -r 1 import bokeh

21.5 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

In [2]: %timeit -n 1 -r 1 import panel

627 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

In [3]: %timeit -n 1 -r 1 import lmfit

524 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

In [4]: %timeit -n 1 -r 1 import ivfit

12 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 1 loop each)

This is on Windows, is there some other caching mechanism I should be aware of?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nitrocalcite/ivfit/issues/5#issuecomment-822570538, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVK7JPN5IHKTGDFMV5XZU3TJRFPZANCNFSM43EVGHZA .

nitrocalcite commented 3 years ago

Hmm, I guess so. Tried again with fresh poetry install on Ubuntu 18.04, which took 1.06s, and seems to be repeatable.