|
1 | | -# PerfTest |
| 1 | +# PerfTest.jl - A performance unit testing framework |
| 2 | + |
| 3 | +NOTE: This package is under active development, bugs may lurk around, if a bug is found please raise an issue so it can be adressed. Thanks :) |
2 | 4 |
|
3 | 5 | [](https://JuliaPerf.github.io/PerfTest.jl/stable) |
4 | 6 | [](https://JuliaPerf.github.io/PerfTest.jl/dev) |
5 | 7 | [](https://github.com/JuliaPerf/PerfTest.jl/actions/workflows/CI.yml?query=branch%3Amain) |
6 | 8 | [](https://codecov.io/gh/JuliaPerf/PerfTest.jl) |
7 | 9 |
|
8 | | -> :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: This repository is under construction :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: |
| 10 | +The package PerfTest provides the user with a performance regression unit testing framework. This package is focused on providing a simple and fast way to develop performance suites, with additional features to customise them for more comprehensice use cases. |
| 11 | + |
| 12 | +## Basic performance evaluation |
| 13 | + |
| 14 | +PerfTest.jl provides a set of macros to provide declarative instructions to the performance testing suit generator. A simple case will be shown here. |
| 15 | + |
| 16 | +```julia |
| 17 | +module VecOps |
| 18 | +function innerProduct(A , B) |
| 19 | + @assert length(A) == length(B) |
| 20 | + |
| 21 | + r = 0. |
| 22 | + |
| 23 | + for i in eachindex(A) |
| 24 | + r += A[i] * B[i] |
| 25 | + end |
| 26 | + |
| 27 | + return r |
| 28 | +end |
| 29 | +end |
| 30 | +``` |
| 31 | + |
| 32 | +In this basic example, we are implementing a inner product function as part of a bigger vector operation package. We are interested in evaluating the performance of that product, the following test file is a recipe to do so: |
| 33 | + |
| 34 | + |
| 35 | +```julia |
| 36 | +using Test, PerfTest |
| 37 | + |
| 38 | +# Disable regression enable verbosity to see successful tests |
| 39 | +@perftest_config " |
| 40 | +[general] |
| 41 | +verbose = true |
| 42 | +" |
| 43 | + |
| 44 | +@testset "Simple test" begin |
| 45 | + |
| 46 | + N = 1000 |
| 47 | + A,B = rand(N), rand(N) |
| 48 | + |
| 49 | + @perfcompare :median_time < (0.000005 * N) |
| 50 | + @perftest VecOps.innerProduct(A,B) |
| 51 | + |
| 52 | +end |
| 53 | + |
| 54 | +``` |
| 55 | + |
| 56 | +Where: |
| 57 | + @perftest sets the computation to target for the tests. |
| 58 | + @perfcompare sets the testing methodology which is comparing the median time elapsed against a reference that is dependent on the size of the vectors. |
| 59 | + @perftest_config sets the configuration in a TOML format, in this case to disable automatic regression testing |
| 60 | + |
| 61 | + |
| 62 | +PertTest.jl relies on a configuration file written in TOML to refer for settings that are not specified anywhere else. In case no file is present, it will be made with the default configuration enabled. Please see the documentation for more information. |
| 63 | + |
| 64 | +## Dependencies |
| 65 | + |
| 66 | +``` |
| 67 | +BenchmarkTools |
| 68 | +CountFlops |
| 69 | +CpuId |
| 70 | +JLD2 |
| 71 | +JSON |
| 72 | +MLStyle |
| 73 | +MacroTools |
| 74 | +STREAMBenchmark |
| 75 | +Suppressor |
| 76 | +UnicodePlots |
| 77 | +Dates |
| 78 | + LinearAlgebra |
| 79 | +Pkg |
| 80 | +Printf |
| 81 | +TOML |
| 82 | +Test |
| 83 | +``` |
| 84 | + |
| 85 | +## Installation |
| 86 | +ImplicitGlobalGrid may be installed directly with the [Julia package manager](https://docs.julialang.org/en/v1/stdlib/Pkg/index.html) from the REPL: |
| 87 | +```julia-repl |
| 88 | +julia>] |
| 89 | + pkg> add https://github.com/JuliaPerf/PerfTest.jl |
| 90 | + pkg> test PerfTest |
| 91 | +``` |
9 | 92 |
|
| 93 | +## Questions, comments and discussions |
10 | 94 |
|
11 | | -This is the source repository of the Julia package `PerfTest.jl`. Please head to the [-> documentation website <-](https://JuliaPerf.github.io/PerfTest.jl) to learn about its usage. |
| 95 | +Please email: [email protected] or raise an issue. |
12 | 96 |
|
| 97 | +## Your contributions |
13 | 98 |
|
14 | | -> :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: This repository is under construction :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: :construction: |
| 99 | +Help is more than welcome! If you have an idea/contribution that could benefit from this project, please share! |
0 commit comments