Profiling Julia code
The goal of code profiling (https://en.wikibooks.org/wiki/Introduction_to_Software_Engineering/Testing/Profiling)https://en.wikibooks.org/wiki/Introduction_to_Software_Engineering/Testing/Profilingis to identify bottlenecks (critical parts)of the code that have a considerable effect on its performance. Once the most time-consuming code sections have been identified, additional code optimization can be considered. From the standpoint of computation time, it makes sense to only optimize those code fragments that take a significant time to run. Julia offers a simple, yet useful, built-in sampling profiler.
Getting ready
The sampling profiler is built into Julia. However, in order to visualize profiling results, theProfileView.jl
package is recommended, whichcan be installed with the Julia package manager. In the Julia command line, press the] key and run the following command:
(v1.0) pkg> add ProfileView
We will also show how to perform profiling using Juno'sJuno.@profile...