From fdf05f68faa37de2f95da1e6ac431c243d8897f7 Mon Sep 17 00:00:00 2001 From: tiyn Date: Wed, 9 Aug 2023 03:31:30 +0200 Subject: [PATCH] benchmarks: added hyperfine --- wiki/benchmark.md | 8 ++++++++ wiki/linux/hyperfine.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 wiki/benchmark.md create mode 100644 wiki/linux/hyperfine.md diff --git a/wiki/benchmark.md b/wiki/benchmark.md new file mode 100644 index 0000000..6d1d288 --- /dev/null +++ b/wiki/benchmark.md @@ -0,0 +1,8 @@ +# Benchmark + +A benchmark is the act of running a program or operation in order to assess its performance. +Benchmarks can use a range of criteria to compare programs with one another. + +## Tools + +- [Hyperfine](/wiki/linux/hyperfine.md) is a benchmarking tool for [Linux](/wiki/linux/linux.md). diff --git a/wiki/linux/hyperfine.md b/wiki/linux/hyperfine.md new file mode 100644 index 0000000..912f8ef --- /dev/null +++ b/wiki/linux/hyperfine.md @@ -0,0 +1,28 @@ +# Hyperfine + +[Hyperfine](https://github.com/sharkdp/hyperfine) is a [benchmarking](/wiki/benchmark.md) tool. + +## Usage + +### Benchmark One or More Programs + +To benchmark a program it is recommended to warm up the cache before. +This can be done as shown in the following command. + +```sh +hyperfine --warmup 5 'sleep 0.3' +``` + +Unless specified otherwise at least 10 runs will be made to benchmark a program. +To change this the `--runs` flag can be used. +An example of it is given in the following command. + +```sh +hyperfine --warmup 5 --runs 3 'sleep 0.3' +``` + +To compare two programs simply append the program to compare to as shown in the following command. + +```sh +hyperfine --warmup 5 'sleep 0.3' 'sleep 0.4' +```