# Code introspection recommendations/advice

**URL:** <https://discourse.julialang.org/t/code-introspection-recommendations-advice/34118>\
**Category:** General Usage\
**Created:** [February 3, 2020, 2:59pm UTC](https://discourse.julialang.org/t/code-introspection-recommendations-advice/34118 "2020-02-03T14:59:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrucePBon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brucepbon/32/11936_2.png) [@BrucePBon](https://discourse.julialang.org/u/BrucePBon)\
**Post date:** [February 3, 2020, 2:59pm UTC](https://discourse.julialang.org/t/code-introspection-recommendations-advice/34118/1 "2020-02-03T14:59:27Z")

</div>

After some testing I obtained that calling the C FFTW library directly from julia is much faster (x5 faster) than using the FFTW julia package. Now I want to understand where this difference might be coming from, therefore I have been inspecting FFTW’s source code.

There is a lot of generated code in FFTW’s source code that I have been reading and preprocessing in my head, but I would like to print the generated functions on my screen. Any ideas on how I can do this?

I checked [a similar question](https://discourse.julialang.org/t/source-code-of-a-function/4499/4), but these answers don’t apply to my case. One the one hand, I can’t install Sugar.jl. Also, `Base.methods(f)` does not work with constructors.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [February 3, 2020, 3:56pm UTC](https://discourse.julialang.org/t/code-introspection-recommendations-advice/34118/2 "2020-02-03T15:56:58Z")

</div>

Have you started Julia with multiple threads? FFTW. jl is sometimes very slow on small kernels due to Julia’s threading.  
[https://github.com/JuliaMath/FFTW.jl/issues/121](https://github.com/JuliaMath/FFTW.jl/issues/121)

---

<div class="post-metadata">

**Author:** ![BrucePBon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brucepbon/32/11936_2.png) [@BrucePBon](https://discourse.julialang.org/u/BrucePBon)\
**Post date:** [February 4, 2020, 10:19am UTC](https://discourse.julialang.org/t/code-introspection-recommendations-advice/34118/3 "2020-02-04T10:19:42Z")

</div>

Thanks for the suggestion. I checked and `Base.Threads.nthreads() = 1.  
I am evaluating my code further to make sure that my speed tests are comparable. I’ll share a working example if I keep observing the speed differences.
