ProfileView takes a long time for "using"

julia> using Profile

julia> @profile using PythonCall

``profiletook a long time (way more than 10 sec.), vs@time using. Is that normal? I thought it, or when using @profilevewdirectly, had hung (maybe it did). It did finish and eventually alsoProfileView.view()`

Longest seems to be loading.jl, require_search__from_serialized: line 831 (i.e. not too useful info?). I see also: MicroMamba.jl executable line:32

What would be the next steps (I tried SnoopPrecompile.jl), I guess I need it for some of the dependencies, which one most important is the question, guessing CondaPkg.jl which depends on (and/or) MicroMamba.jl.

@cjdois EDIT: I’m passed that error by disabling SnoopPrecomple for MicroMamba, and got 7.05-5.34 = 1.71 sec. speedup, something, not nothing, but only 24% faster, less than I was hoping for. And I still get 5.56 sec. with:

$ julia -O0

After misapplying SnoopPrecomple (only using the setup macro, can it be skipped? I’m now using both) and doing the right thing now, or I thought, I’m stuck now and get:

julia> @time using PythonCall
[ Info: Precompiling PythonCall [6099a3de-0909-46bc-b1f4-468b9a2dfc0d]
ERROR: InitError: UndefVarError: root_dir not defined
  [1] activate!(e::Any)
    @ CondaPkg ~/.julia/dev/CondaPkg/src/env.jl:18
  [2] init_context()
    @ PythonCall.C ~/.julia/dev/PythonCall/src/cpython/context.jl:88
  [3] __init__()
    @ PythonCall.C ~/.julia/dev/PythonCall/src/cpython/CPython.jl:21
  [4] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base ./loading.jl:831
  [5] _tryrequire_from_serialized(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:978
  [6] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1347
  [7] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [8] macro expansion
    @ ./loading.jl:1180 [inlined]
  [9] macro expansion
    @ ./lock.jl:223 [inlined]
 [10] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
 [11] top-level scope
    @ ./timing.jl:262 [inlined]
 [12] top-level scope
    @ ./REPL[4]:0
during initialization of module C

Try Profile.init to increase the interval between snapshots, that will decrease the performance-penalty of @profile.

1 Like