JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.78k stars 409 forks source link

Notebook kernel startup/restart is slow #1090

Open tfiers opened 1 year ago

tfiers commented 1 year ago

Restarting the notebook ("Restart and run all cells") and waiting for the output of the first cell (containing just 1) takes about 10 seconds.[^1]

[^1]: This test was ran with Julia 1.9.0-beta3. I re-ran the stopwatch test in 1.9.3, and the time seems to have been reduced to 8.6 seconds.

For comparison, doing the same in a Python notebook takes about 2.7 seconds (i.e. not orders of magnitude off, but still a significant difference).

I wonder what that time is spent on (but don't immediately see how to profile this), and how it could be improved.

In the terminal:

julia> @time using IJulia
  0.806597 seconds (293.19 k allocations: 19.490 MiB, 2.50% compilation time)

and Julia itself:

$ time julia -e "print(1)"
1
real    0m0.320s
user    0m0.000s
sys     0m0.000s

Similar issue (but 8 years old and closed, so not resuscitating that):

Info:

Julia Version 1.9.0-beta3
Commit 24204a7344 (2023-01-18 07:20 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 7 on 8 virtual cores
Environment:
  JULIA_EDITOR = code.cmd
  JULIA_NUM_THREADS = 7