# @snoop\_inference taking a very long time?

**URL:** https://discourse.julialang.org/t/snoop-inference-taking-a-very-long-time/133233
**Category:** Performance
**Tags:** snoopcompile
**Created:** [October 17, 2025, 11:43am UTC](https://discourse.julialang.org/t/snoop-inference-taking-a-very-long-time/133233 "2025-10-17T11:43:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![johnomotani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnomotani/32/26753_2.png) [@johnomotani](https://discourse.julialang.org/u/johnomotani)
#### Post date: [October 17, 2025, 11:43am UTC](https://discourse.julialang.org/t/snoop-inference-taking-a-very-long-time/133233/1 "2025-10-17T11:43:23Z")

</div>

Running `@snoop_inference` on a function from my package is taking a very long time - it’s been running for an hour since the function finished executing and hasn’t returned yet. Is this a known issue in any cases? Any suggestions for debugging? The function itself takes about 3 minutes to compile/run (mostly compile) and is admittedly pretty complicated - but that’s why I want to profile the compilation/inference!

I’m using Julia v1.12.0, SnoopCompileCore v3.1.1. Some simple ‘hello world’ type example in the REPL works fine, and completes almost instantaneously.

---

<div class="post-metadata">

### Author: ![johnomotani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnomotani/32/26753_2.png) [@johnomotani](https://discourse.julialang.org/u/johnomotani)
#### Post date: [October 17, 2025, 12:42pm UTC](https://discourse.julialang.org/t/snoop-inference-taking-a-very-long-time/133233/2 "2025-10-17T12:42:05Z")

</div>

I tried profiling the @snoop\_inference call, and found that it seems to be taking a huge amount of time here

> <https://github.com/JuliaDebug/SnoopCompile.jl/blob/a0a03f3b2943a6275cd58aa3dec64d172bda264e/SnoopCompileCore/src/snoop_inference.jl#L139>

Maybe this should be expected if the tree is very large, but my original call is up to about 2 hours now, and still not finished…

---

<div class="post-metadata">

### Author: ![johnomotani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnomotani/32/26753_2.png) [@johnomotani](https://discourse.julialang.org/u/johnomotani)
#### Post date: [October 17, 2025, 2:03pm UTC](https://discourse.julialang.org/t/snoop-inference-taking-a-very-long-time/133233/3 "2025-10-17T14:03:51Z")

</div>

Maybe this is a bug?

> <https://github.com/JuliaDebug/SnoopCompile.jl/issues/444>
>
> I have a case where I get stuck in an infinite loop here
> https://github.com/Juli…aDebug/SnoopCompile.jl/blob/a0a03f3b2943a6275cd58aa3dec64d172bda264e/SnoopCompileCore/src/snoop\_inference.jl#L127-L155
> 
> I think what's happening is that \`be ∉ handled\` is true the first time it is tested, for \`k == j\`. That means that \`j\` never increments, and the loop never ends. I don't understand what's being done here, but if I change line 137 to
> \`\`\`julia
> k ≤ j && continue # don't get caught in cycles
> \`\`\`
> instead of \`k \< j\`, then there's no infinite loop, and the output looks reasonable. Is this a correct fix?
