# ProfileView takes a long time for "using"

**URL:** <https://discourse.julialang.org/t/profileview-takes-a-long-time-for-using/89530>\
**Category:** Performance\
**Created:** [October 30, 2022, 5:46pm UTC](https://discourse.julialang.org/t/profileview-takes-a-long-time-for-using/89530 "2022-10-30T17:46:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [October 30, 2022, 5:46pm UTC](https://discourse.julialang.org/t/profileview-takes-a-long-time-for-using/89530/1 "2022-10-30T17:46:28Z")

</div>

```julia
julia> using Profile

julia> @profile using PythonCall

```

``profile`took a long time (way more than 10 sec.), vs`@time using`. Is that normal? I thought it, or when using `@profilevew`directly, had hung (maybe it did). It did finish and eventually also`ProfileView.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.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [October 30, 2022, 6:24pm UTC](https://discourse.julialang.org/t/profileview-takes-a-long-time-for-using/89530/2 "2022-10-30T18:24:49Z")

</div>

@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
$ 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
julia> @time using PythonCall
[Info: Precompiling PythonCall [6099a3de-0909-46bc-b1f4-468b9a2dfc0d]
ERROR: InitError: UndefVarError: root_dir not defined
Stacktrace:
  [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

```

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [October 31, 2022, 7:35am UTC](https://discourse.julialang.org/t/profileview-takes-a-long-time-for-using/89530/3 "2022-10-31T07:35:53Z")

</div>

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