Bencher supports the most popular benchmarking harnesses out-of-the-box, and we are always open to suggestions for new adapters. However there can be situations where an off-the-shelf benchmarking harness doesn’t fit your needs, necessitating the creation of a custom benchmarking harness. Lucky for you, Bencher also supports using a custom benchmarking harness. The easiest way to integrate your custom benchmark harness with Bencher is to output Bencher Metric Format (BMF) JSON.

This is an example of BMF JSON:

"benchmark_name": {
"latency": {
"value": 88.0,
"lower_value": 87.42,
"upper_value": 88.88

In this example, the key benchmark_name would be the name of a Benchmark. Benchmark names can be any non-empty string up to 1024 characters. The benchmark_name object can contain multiple Measure names, slugs, or UUIDs as keys. If the value specified is a name or slug and the Measure does not already exist, it will be created for you. However, if the value specified is a UUID then the Measure must already exist. In this example, latency is the slug for the built-in Latency Measure. Each Project by default has a Latency (ie latency) and Throughput (ie throughput) Measure, which are measured in nanosecond (ns) and operations / second (ops/s) respectively. The Measure object contains a Metric with up to three values: value, lower_value, and upper_value. The lower_value and upper_value values are optional.

In this example, the latency Measure object contains the following values:

  • A value of 88.0
  • A lower_value of 87.42
  • An upper_value of 88.88

If you had a script located at ./run/my/ that ran your benchmarks and printed the results to standard out as BMF JSON, then you could track them using bencher run and the json adapter with the following command:

Terminal window
bencher run --adapter json ./run/my/

If your results were instead stored in a file named results.json, then you could use the --file option to specify the file path. This works both with a benchmark command and without one.

With a benchmark command:

Terminal window
bencher run --file results.json --adapter json ./run/my/

Without a benchmark command:

Terminal window
./run/my/ && bencher run --file results.json --adapter json

🐰 おめでとうございます!カスタムベンチマークの追跡方法を学びました!🎉

続けて:CIでベンチマークを追跡する方法 ➡

🤖 このドキュメントは OpenAI GPT-4 によって自動的に生成されました。 正確ではない可能性があり、間違いが含まれている可能性があります。 エラーを見つけた場合は、GitHub で問題を開いてください。.

Published: Sun, May 12, 2024 at 7:44:00 AM UTC