PerfTest provides a set of macros to instrument ordinary Julia test files with performance tests. The idea is to have the posibility of having a functional and a performance suite all in the same place.
The underlying idea of declaring performance tests can be boiled down the following:
The following dummy example embodies the paradigm of the package:
using ExampleModule : innerProduct, Test, PerfTest # Importing the target and test libraries
@testset "Roofline Test" begin
a,b = rand(1e6),rand(1e6)
@roofline actual_flops=:autoflop target_ratio=0.5
:autoflop / (2 * 8 * 1e6)
end
@perftest innerProduct(a, b)
@test innerProduct(a,b) == sum(a .* b)
end
The following things can be appreciated in this example:
For more information have a look at the Examples and see the API reference for details on the usage of PerfTest.
PerfTest can be installed directly with the [Julia package manager] from the [Julia REPL]:
using Pkg
Pkg.add("https://github.com/JuliaPerf/PerfTest.jl.git")