# Any easy way to debug when a function is compiled?

**URL:** <https://discourse.julialang.org/t/any-easy-way-to-debug-when-a-function-is-compiled/82456>\
**Category:** General Usage\
**Created:** [June 8, 2022, 6:26pm UTC](https://discourse.julialang.org/t/any-easy-way-to-debug-when-a-function-is-compiled/82456 "2022-06-08T18:26:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [June 8, 2022, 6:26pm UTC](https://discourse.julialang.org/t/any-easy-way-to-debug-when-a-function-is-compiled/82456/1 "2022-06-08T18:26:42Z")

</div>

A typical pattern in Jax to check when a function gets compiled (useful for debugging excessive recompliation) is,

```python
@jax.jit
def f():
    print("compiling")
    return 0

f() # prints "compiling"
f() # doesnt print anything since the print is removed from a compiled version

```

Is there anything similarly as easy in Julia? (I’m aware of SnoopCompile which I think would get you this, just maybe not as easy)

---

<div class="post-metadata">

**Author:** ![gbaraldi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gbaraldi/32/22101_2.png) [@gbaraldi](https://discourse.julialang.org/u/gbaraldi)\
**Post date:** [June 8, 2022, 6:31pm UTC](https://discourse.julialang.org/t/any-easy-way-to-debug-when-a-function-is-compiled/82456/2 "2022-06-08T18:31:13Z")

</div>

In julia a function has a method compiled when called, but some things can invalidate the method and lead to recompilation. A nice tool for looking for this is [GitHub - timholy/SnoopCompile.jl: Making packages work faster with more extensive precompilation](https://github.com/timholy/SnoopCompile.jl)

---

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [June 8, 2022, 6:45pm UTC](https://discourse.julialang.org/t/any-easy-way-to-debug-when-a-function-is-compiled/82456/3 "2022-06-08T18:45:06Z")

</div>

Yes, I am aware of SnoopCompile but I’m just curious if there’s any quick and dirty way to get the info by doing something simple like inserting a statement into the function kind of like Jax.
