Immediately-called funs optimization (looking for docs)

Hello,

I remember having read a patch note telling that funs that were invoked right after been created were optimized (unwrapped ?) by the compiler. But I can’t find it and I am not sure anymore.

I am writing some macros that would be way more readable using immediately invoked funs, but as there would be a lot of calls to the code created by those macros I would be sure that it will be optimized.

Does anybody have a pointer to those docs?

Thank you.

1 Like

Generally speaking compiler optimizations like those are documented because they may be added, removed, modified, etc. Your best bet is to compare the compiled artifact. A project like @michalmuskala’s decompile can help here: GitHub - michalmuskala/decompile

1 Like

Hi @josevalim , I use an equivalent decompiler, but I was not sure the compiled code would have such optimizations applied to the debug info. I will check. Thank you.