Basic Performance Analysis Package

I was wondering if there is a package to test my code to point out the common pitfalls that slows down my code? Like type instability and boxing and unboxing and etc???

Thanks

These lecture notes mention a few packages and how to use them.

https://mitmath.github.io/18337/lecture18/code_profiling

Some only get mentions, but that should be enough to start digging around.

5 Likes

We go through similar stuff here
https://github.com/baggepinnen/juliacourse/blob/master/lecture3/performance.pdf

7 Likes

I have made my comment a community wiki. Please feel free to edit this comment to add more packages to the list.

First of all, I always recommend reading the Performance Tips section of the manual.

Now for the list of packages:

  1. Traceur.jl: “runs your code and tells you about any obvious performance traps.” I think this is the package that best answers the original question.

  2. Cthulhu.jl: “can help you debug type inference issues by recursively showing the code_typed output until you find the exact point where inference gave up, messed up, or did something unexpected.”

  3. BenchmarkTools.jl: “makes performance tracking of Julia code easy by supplying a framework for writing and running groups of benchmarks as well as comparing benchmark results.”

  4. The Profile standard library: Julia’s built-in sampling (statistical) profiler. “When used, it takes measurements on running code, and produces output that helps you understand how much time is spent on individual line(s). The most common usage is to identify “bottlenecks” as targets for optimization.”

  5. TimerOutputs.jl: “generate formatted output from timings made in different sections of a program”

14 Likes