Skip to content

Commit

Permalink
Merge pull request #12 from epompeii/bencher
Browse files Browse the repository at this point in the history
Move to Bencher CLI GitHub Action
  • Loading branch information
estk authored Dec 1, 2023
2 parents cf235f4 + 074b3d1 commit bf13422
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Benchmark

on:
pull_request_target:
push:
branches:
- main
- 'feature-**'

env:
CARGO_TERM_COLOR: always

jobs:
benchmark_with_bencher:
name: Track benchmarks with Bencher
runs-on: ubuntu-latest
env:
BENCHER_PROJECT: trace4rs
BENCHER_ADAPTER: rust_criterion
BENCHER_TESTBED: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
persist-credentials: false
- uses: bencherdev/bencher@main
- name: Benchmark trace4rs with Bencher
run: |
bencher run \
--if-branch "${{ github.event.pull_request.head.ref }}" \
--else-if-branch "${{ github.event.pull_request.base.ref }}" \
--else-if-branch main \
--err \
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
--token "${{ secrets.BENCHER_API_TOKEN }}" \
"cargo bench"
21 changes: 0 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,3 @@ jobs:
- name: Build
run: |
cargo build --release ${{ matrix.features_arg }}
benchmark:
name: Run benchmarks
runs-on: ubuntu-latest
env:
BENCHER_PROJECT: trace4rs
BENCHER_TESTBED: ubuntu-latest
BENCHER_ADAPTER: rust
BENCHER_VERSION: 0.2.27
BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Install
run: |
rustup update
rustup toolchain install nightly
wget https://github.com/bencherdev/bencher/releases/download/v${BENCHER_VERSION}/bencher_${BENCHER_VERSION}_amd64.deb
sudo dpkg -i bencher_${BENCHER_VERSION}_amd64.deb
- name: Benchmark with Bencher
run: bencher run --if-branch $GITHUB_REF_NAME --err "cargo bench"

2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ For a usage example see the `examples` folder or `src/test.rs`.

### Benchmarks & Results

<a href="https://bencher.dev/perf/trace4rs?reports_per_page=4&reports_page=1&branches_per_page=8&branches_page=1&testbeds_per_page=8&testbeds_page=1&benchmarks_per_page=8&benchmarks_page=1"><img src="https://api.bencher.dev/v0/projects/trace4rs/perf/img?metric_kinds=6daa0563-984c-40c9-8716-cad463cc693b&branches=7c0ad2df-9b1c-4361-b0a5-8d87f8002dd4&testbeds=15a6cfb2-7ff5-4c89-abe9-d153f08a5ae0&benchmarks=422c918d-bf2f-4470-87b7-f06f6fc854ea%2C6d950af0-8d62-46fa-96e6-f694921e3cb6&title=log4rs+vs+trace4rs" title="log4rs vs trace4rs" alt="log4rs vs trace4rs for trace4rs - Bencher" /></a>

The takeaway is that the actual appenders are roughly equivalent in
performance. However, when using the `tracing` macros vs the `log` macros
the appender performance is roughly 2 orders of magnitude larger.
Expand Down

0 comments on commit bf13422

Please sign in to comment.