Skip to content

Commit

Permalink
bench: add bench action (#173)
Browse files Browse the repository at this point in the history
* add bench action

Signed-off-by: GanZiheng <[email protected]>
  • Loading branch information
GanZiheng committed Jul 12, 2022
1 parent e987131 commit a4e06f1
Show file tree
Hide file tree
Showing 13 changed files with 728 additions and 443 deletions.
81 changes: 23 additions & 58 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Do not run this workflow on pull request since this workflow has permission to modify contents.
on:
workflow_dispatch:
inputs:
reason:
description: 'reason to trigger this build'
required: false

push:
branches:
- master

permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

name: Bench

jobs:
Expand All @@ -26,55 +31,15 @@ jobs:
with:
toolchain: nightly
default: true
- uses: actions-rs/cargo@v1
name: Benchmark 🚀
with:
command: bench
args: --all-features --workspace
sanitizer_bench:
name: Bench with Sanitizer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout 🛎️
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-sanitizer-bench
- uses: actions-rs/toolchain@v1
name: Setup Cargo Toolchain 🛎️
with:
components: rust-src
toolchain: nightly
default: true
- uses: actions-rs/cargo@v1
name: Bench with Address Sanitizer 🚀
with:
command: bench
args: --all-features -Zbuild-std --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Zsanitizer=address"
- uses: actions-rs/cargo@v1
name: Bench with Leak Sanitizer 🚀
with:
command: bench
args: --all-features -Zbuild-std --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Zsanitizer=leak"
- uses: actions-rs/cargo@v1
name: Bench with Memory Sanitizer 🚀
with:
command: bench
args: --all-features -Zbuild-std --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Zsanitizer=memory"
- uses: actions-rs/cargo@v1
name: Bench with Thread Sanitizer 🚀
with:
command: bench
args: --all-features -Zbuild-std --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Zsanitizer=thread"
- name: Benchmark 🚀
run: cargo +nightly bench --all-features --workspace --bench benches_agate_rocks -- --output-format bencher | tee output.txt
- uses: benchmark-action/github-action-benchmark@v1
name: Store benchmark result
with:
name: Benchmark with RocksDB
tool: "cargo"
output-file-path: output.txt
# Access token to deploy GitHub Pages branch
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: true
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ version = "0.1.0"
authors = ["Jay Lee <[email protected]>"]
edition = "2018"

[features]
default = []
enable-rocksdb = ["rocksdb"]

[dependencies]
bytes = "1.0"
coarsetime = "0.1.22"
Expand All @@ -20,6 +24,7 @@ parking_lot = "0.11"
prost = "0.8"
proto = { path = "proto" }
rand = "0.7"
rocksdb = { version = "0.15", optional = true }
skiplist = { path = "skiplist" }
tempdir = "0.3"
thiserror = "1.0"
Expand Down Expand Up @@ -51,6 +56,10 @@ harness = false
name = "bench_iterator"
harness = false

[[bench]]
name = "benches_agate_rocks"
harness = false

[profile.bench]
opt-level = 3
debug = false
Expand Down
1 change: 1 addition & 0 deletions agate_bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ clap = "2.33"
indicatif = "0.15"
rand = "0.7"
rocksdb = { version = "0.15", optional = true }
tempdir = "0.3"
threadpool = "1.8"
yatp = { git = "https://github.com/tikv/yatp.git" }

Expand Down
Loading

0 comments on commit a4e06f1

Please sign in to comment.