GitHub - bencherdev/bencher: ๐Ÿฐ Bencher - Continuous Benchmarking (original) (raw)

Bencher

Bencher is a suite of continuous benchmarking tools. Have you ever had a performance regression impact your users? Bencher could have prevented that from happening. Bencher allows you to detect and prevent performance regressions before they hit production.

For the same reasons that unit tests are run in CI to prevent feature regressions, benchmarks should be run in CI with Bencher to prevent performance regressions. Performance bugs are bugs!

Bencher consists of:

Though Bencher is open source, there is also a hosted version available Bencher Cloud.

The best place to start is the Bencher Quick Start tutorial.

Start Continuous Benchmarking

๐Ÿฐ Use the GitHub Action with your project

Documentation

๐ŸŒ Also available in:

Supported Benchmark Harnesses

๐Ÿ‘‰ For more details see the explanation of benchmark harness adapters.

Showcase

Microsoft Microsoft CCF Rustls TLS Library Rustls Diesel Diesel
Hydra Database Hydra Database GreptimeDB GreptimeDB Tailcall Tailcall
Servo Servo Ratatui Ratatui Wire Wire

๐Ÿ‘‰ Checkout all public projects.

GitHub Actions

Install the Bencher CLI using the GitHub Action, and use it for continuous benchmarking in your project.

name: Continuous Benchmarking with Bencher on: push: branches: main jobs: benchmark_with_bencher: name: Benchmark with Bencher runs-on: ubuntu-latest env: BENCHER_PROJECT: my-project-slug BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} steps: - uses: actions/checkout@v4 - uses: bencherdev/bencher@main - run: bencher run "bencher mock"

Supported Operating Systems:

๐Ÿ‘‰ For more details see the explanation of how to use GitHub Actions.

Repository Secrets

Add BENCHER_API_TOKEN to you Repository secrets (ex: Repo -> Settings -> Secrets and variables -> Actions -> New repository secret). You can find your API tokens by running bencher token list my-user-slug or view them in the Bencher Console.

Error on Alert

You can set the bencher run CLI subcommand to error if an Alert is generated with the --err flag.

bencher run --err "bencher mock"

๐Ÿ‘‰ For more details see the explanation of bencher run.

Comment on PRs

You can set the bencher run CLI subcommand to comment on a PR with the --github-actions argument.

bencher run --github-actions "${{ secrets.GITHUB_TOKEN }}" "bencher mock"

๐Ÿ‘‰ For more details see the explanation of bencher run.

Example PR Comment

๐Ÿšจ 1 ALERT: Threshold Boundary Limit exceeded!

Benchmark MeasureUnits View Benchmark Result(Result ฮ”%) Upper Boundary(Limit %)
Adapter::Json Latency microseconds (ยตs) ๐Ÿ“ˆ plot๐Ÿšจ alert๐Ÿšท threshold 3.45(+1.52%) 3.36(102.48%)

Click to view all benchmark results

Benchmark Latency Benchmark Resultsmicroseconds (ยตs)(Result ฮ”%) Upper Boundarymicroseconds (ยตs)(Limit %)
Adapter::Json ๐Ÿ“ˆ view plot๐Ÿšจ view alert๐Ÿšท view threshold 3.45(+1.52%) 3.36(102.48%)
Adapter::Magic (JSON) ๐Ÿ“ˆ view plot๐Ÿšท view threshold 3.43(+0.69%) 3.60(95.40%)
Adapter::Magic (Rust) ๐Ÿ“ˆ view plot๐Ÿšท view threshold 22.10(-0.83%) 24.73(89.33%)
Adapter::Rust ๐Ÿ“ˆ view plot๐Ÿšท view threshold 2.31(-2.76%) 2.50(92.21%)
Adapter::RustBench ๐Ÿ“ˆ view plot๐Ÿšท view threshold 2.30(-3.11%) 2.50(91.87%)

๐Ÿฐ View full continuous benchmarking report in Bencher

Specify CLI Version

There is also an optional version argument to specify an exact version of the Bencher CLI to use. Otherwise, it will default to using the latest CLI version.

Specify an exact version if using Bencher Self-Hosted. Do not specify an exact version if using Bencher Cloud as there are still occasional breaking changes.

These Devs Get It

Bencher is like CodeCov for performance metrics. Jonathan Woollett-Light Jonathan Woollett-Light @JonathanWoollett-Light I think I'm in heaven. Now that I'm starting to see graphs of performance over time automatically from tests I'm running in CI. It's like this whole branch of errors can be caught and noticed sooner. Price Clark Price Clark @gpwclark
95% of the time I don't want to think about my benchmarks. But when I need to, Bencher ensures that I have the detailed historical record waiting there for me. It's fire-and-forget. Joe Neeman Joe Neeman @jneem I've been looking for a public service like Bencher for about 10 years :) Jamie Wilkinson Jamie Wilkinson @jaqx0r
I'm happy with how quickly I was able to get Bencher configured and working. Weston Pace Weston Pace @westonpace Bencher's main ideas and concepts are really well designed. Free Ekanayaka Free Ekanayaka @freeekanayaka

Contributing

The easiest way to contribute is to open this repo as a Dev Container in VSCode by simply clicking one of the buttons below. Everything you need will already be there! Once set up, both the UI and API should be built, running, and seeded at localhost:3000 and localhost:61016 respectively. To make any changes to the UI or API though, you will have to exit the startup process and restart the UI and API yourself.

For additional information on contributing, see the Development Getting Started guide.

๐Ÿฐ All pull requests should target the devel branch

Bencher VSCode Dev Container

Bencher GitHub Codespaces

There is also a pre-built image from CI available for each branch: ghcr.io/bencherdev/bencher-dev-container

License

All content that resides under any directory or feature named "plus" is licensed under the Bencher Plus License.

All other content is licensed under the Apache License, Version 2.0 or MIT License at your discretion.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Bencher by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.