From 4919d8c2f86f69f669a1afba2a28d5c344fe7197 Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Mon, 29 Jan 2024 23:12:20 +0100 Subject: perf: improve benchmarks Signed-off-by: Henry Gressmann --- BENCHMARKS.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 BENCHMARKS.md (limited to 'BENCHMARKS.md') diff --git a/BENCHMARKS.md b/BENCHMARKS.md new file mode 100644 index 0000000..c86679c --- /dev/null +++ b/BENCHMARKS.md @@ -0,0 +1,42 @@ +# Benchmark results + +All benchmarks are run on a Ryzen 7 5800X, with 32GB of RAM, running Linux 6.6 with `intel_pstate=passive split_lock_detect=off mitigations=off`. + +## Results + +Coming soon. + +## WebAssembly Settings + +All WebAssembly files are compiled with the following settings: + +- `opt-level` is set to 3, `lto` is set to `thin`, `codegen-units` is set to 1. +- `reference-types`, `bulk-memory`, `mutable-globals` proposals are enabled. + +## Runtime Settings + +All runtimes are compiled with the following settings: + +- `unsafe` features are enabled +- `opt-level` is set to 3, `lto` is set to `thin`, `codegen-units` is set to 1. + +# Running benchmarks + +Benchmarks are run using [Criterion.rs](https://github.com/bheisler/criterion.rs). To run a benchmark, use the following command: + +```sh +$ cargo bench --bench +``` + +## Profiling + +To profile a benchmark, use the following command: + +```sh +$ cargo flamegraph --bench -- --bench +``` + +This will generate a flamegraph in `flamegraph.svg` and a `perf.data` file. +You can use [hotspot](https://github.com/KDAB/hotspot) to analyze the `perf.data` file. +Since a lot of functions are inlined, you probably want to remove the `#[inline]` attribute from the functions you care about. +Note that this will make the benchmark considerably slower, 2-10x slower in some cases. -- cgit v1.3.1