All Projects → JuliaCI → Benchmarktools.jl

JuliaCI / Benchmarktools.jl

Licence: other
A benchmarking framework for the Julia language

Programming Languages

julia
2034 projects

Labels

Projects that are alternatives of or similar to Benchmarktools.jl

MaskedFaceRepresentation
Masked face recognition focuses on identifying people using their facial features while they are wearing masks. We introduce benchmarks on face verification based on masked face images for the development of COVID-safe protocols in airports.
Stars: ✭ 17 (-94.55%)
Mutual labels:  benchmark
Perfops Cli
A simple command line tool to interact with hundreds of servers around the world.
Stars: ✭ 263 (-15.71%)
Mutual labels:  benchmark
Pyaf
PyAF is an Open Source Python library for Automatic Time Series Forecasting built on top of popular pydata modules.
Stars: ✭ 289 (-7.37%)
Mutual labels:  benchmark
FewCLUE
FewCLUE 小样本学习测评基准,中文版
Stars: ✭ 251 (-19.55%)
Mutual labels:  benchmark
PPM
A High-Quality Photograpy Portrait Matting Benchmark
Stars: ✭ 37 (-88.14%)
Mutual labels:  benchmark
Github Action Benchmark
GitHub Action for continuous benchmarking to keep performance
Stars: ✭ 264 (-15.38%)
Mutual labels:  benchmark
IGUANA
IGUANA is a benchmark execution framework for querying HTTP endpoints and CLI Applications such as Triple Stores. Contact: [email protected]
Stars: ✭ 22 (-92.95%)
Mutual labels:  benchmark
Tape
Tasks Assessing Protein Embeddings (TAPE), a set of five biologically relevant semi-supervised learning tasks spread across different domains of protein biology.
Stars: ✭ 295 (-5.45%)
Mutual labels:  benchmark
grpc bench
Various gRPC benchmarks
Stars: ✭ 480 (+53.85%)
Mutual labels:  benchmark
Web Tooling Benchmark
JavaScript benchmark for common web developer workloads
Stars: ✭ 290 (-7.05%)
Mutual labels:  benchmark
tls-perf
TLS handshakes benchnarking tool
Stars: ✭ 18 (-94.23%)
Mutual labels:  benchmark
Long-Map-Benchmarks
Benchmarking the best way to store long, Object value pairs in a map.
Stars: ✭ 32 (-89.74%)
Mutual labels:  benchmark
Superpixel Benchmark
An extensive evaluation and comparison of 28 state-of-the-art superpixel algorithms on 5 datasets.
Stars: ✭ 275 (-11.86%)
Mutual labels:  benchmark
criterion-compare-action
⚡️📊 Compare the performance of Rust project branches
Stars: ✭ 16 (-94.87%)
Mutual labels:  benchmark
Lanczosnetwork
Lanczos Network, Graph Neural Networks, Deep Graph Convolutional Networks, Deep Learning on Graph Structured Data, QM8 Quantum Chemistry Benchmark, ICLR 2019
Stars: ✭ 293 (-6.09%)
Mutual labels:  benchmark
glassbench
A micro-benchmark framework to use with cargo bench
Stars: ✭ 29 (-90.71%)
Mutual labels:  benchmark
Go Benchmark
Golang benchmarks used for optimizing code
Stars: ✭ 263 (-15.71%)
Mutual labels:  benchmark
Datasets
A repository of pretty cool datasets that I collected for network science and machine learning research.
Stars: ✭ 302 (-3.21%)
Mutual labels:  benchmark
Api Benchmark
A node.js tool to benchmark APIs
Stars: ✭ 293 (-6.09%)
Mutual labels:  benchmark
Bench
A generic latency benchmarking library.
Stars: ✭ 286 (-8.33%)
Mutual labels:  benchmark

BenchmarkTools.jl

Build Status Code Coverage

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

This package is used to write and run the benchmarks found in BaseBenchmarks.jl.

The CI infrastructure for automated performance testing of the Julia language is not in this package, but can be found in Nanosoldier.jl.

Installation

To install BenchmarkTools, you can run the following:

Pkg.add("BenchmarkTools")

Documentation

If you're just getting started, check out the manual for a thorough explanation of BenchmarkTools.

If you want to explore the BenchmarkTools API, see the reference document.

If you want a short example of a toy benchmark suite, see the sample file in this repo (benchmark/benchmarks.jl).

If you want an extensive example of a benchmark suite being used in the real world, you can look at the source code of BaseBenchmarks.jl.

If you're benchmarking on Linux, I wrote up a series of tips and tricks to help eliminate noise during performance tests.

Quick Start

The primary macro provided by BenchmarkTools is @benchmark:

julia> using BenchmarkTools

# The `setup` expression is run once per sample, and is not included in the
# timing results. Note that each sample can require multiple evaluations
# benchmark kernel evaluations. See the BenchmarkTools manual for details.
julia> @benchmark sin(x) setup=(x=rand())
BenchmarkTools.Trial:
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     4.248 ns (0.00% GC)
  median time:      4.631 ns (0.00% GC)
  mean time:        5.502 ns (0.00% GC)
  maximum time:     60.995 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     1000

For quick sanity checks, one can use the @btime macro, which is a convenience wrapper around @benchmark whose output is analogous to Julia's built-in @time macro:

julia> @btime sin(x) setup=(x=rand())
  4.361 ns (0 allocations: 0 bytes)
0.49587200950472454

If the expression you want to benchmark depends on external variables, you should use $ to "interpolate" them into the benchmark expression to avoid the problems of benchmarking with globals. Essentially, any interpolated variable $x or expression $(...) is "pre-computed" before benchmarking begins:

julia> A = rand(3,3);

julia> @btime inv($A);            # we interpolate the global variable A with $A
  1.191 μs (10 allocations: 2.31 KiB)

julia> @btime inv($(rand(3,3)));  # interpolation: the rand(3,3) call occurs before benchmarking
  1.192 μs (10 allocations: 2.31 KiB)

julia> @btime inv(rand(3,3));     # the rand(3,3) call is included in the benchmark time
  1.295 μs (11 allocations: 2.47 KiB)

Sometimes, interpolating variables into very simple expressions can give the compiler more information than you intended, causing it to "cheat" the benchmark by hoisting the calculation out of the benchmark code

julia> a = 1; b = 2
2

julia> @btime $a + $b
  0.024 ns (0 allocations: 0 bytes)
3

As a rule of thumb, if a benchmark reports that it took less than a nanosecond to perform, this hoisting probably occured. You can avoid this by referencing and dereferencing the interpolated variables

julia> @btime $(Ref(a))[] + $(Ref(b))[]
  1.277 ns (0 allocations: 0 bytes)
3

As described the manual, the BenchmarkTools package supports many other features, both for additional output and for more fine-grained control over the benchmarking process.

Why does this package exist?

Our story begins with two packages, "Benchmarks" and "BenchmarkTrackers". The Benchmarks package implemented an execution strategy for collecting and summarizing individual benchmark results, while BenchmarkTrackers implemented a framework for organizing, running, and determining regressions of groups of benchmarks. Under the hood, BenchmarkTrackers relied on Benchmarks for actual benchmark execution.

For a while, the Benchmarks + BenchmarkTrackers system was used for automated performance testing of Julia's Base library. It soon became apparent that the system suffered from a variety of issues:

  1. Individual sample noise could significantly change the execution strategy used to collect further samples.
  2. The estimates used to characterize benchmark results and to detect regressions were statistically vulnerable to noise (i.e. not robust).
  3. Different benchmarks have different noise tolerances, but there was no way to tune this parameter on a per-benchmark basis.
  4. Running benchmarks took a long time - an order of magnitude longer than theoretically necessary for many functions.
  5. Using the system in the REPL (for example, to reproduce regressions locally) was often cumbersome.

The BenchmarkTools package is a response to these issues, designed by examining user reports and the benchmark data generated by the old system. BenchmarkTools offers the following solutions to the corresponding issues above:

  1. Benchmark execution parameters are configured separately from the execution of the benchmark itself. This means that subsequent experiments are performed more consistently, avoiding branching "substrategies" based on small numbers of samples.
  2. A variety of simple estimators are supported, and the user can pick which one to use for regression detection.
  3. Noise tolerance has been made a per-benchmark configuration parameter.
  4. Benchmark configuration parameters can be easily cached and reloaded, significantly reducing benchmark execution time.
  5. The API is simpler, more transparent, and overall easier to use.

Acknowledgements

This package was authored primarily by Jarrett Revels (@jrevels). Additionally, I'd like to thank the following people:

  • John Myles White, for authoring the original Benchmarks package, which greatly inspired BenchmarkTools
  • Andreas Noack, for statistics help and investigating weird benchmark time distributions
  • Oscar Blumberg, for discussions on noise robustness
  • Jiahao Chen, for discussions on error analysis
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].