A way for identifying the code portion being re-compiled?

Motivation: I done some re-structuring to my code. Afterwords, re-executing with the @time macro within REPL indicates that part of the code is getting re-compiled, e.g.

.... seconds (... , 50.63% compilation time: 100% of which was recompilation)

This was not the case before code re-structuring.

Question: Is there a quick way to find out which portion of the code is getting re-compiled?
I am using Julia V1.9.0

The way to figure which code got recompiled can be done via SnoopCompile.jl: Snooping on and fixing invalidations: @snoopr · SnoopCompile

The code that needs to get recompiled is first “invalidated”. Followi the instructions at the link above, and it will show you how to use the @snoopr macro to find the invalidations.

2 Likes