Skip to content

Commit

Permalink
Add benchmarks (#16)
Browse files Browse the repository at this point in the history
* ci: add benchmark CI job

* chore: update bench example

* build: add bencher deps & other metadata

* chore: add bench tests & code refactor for perf

* ci: reduce benchmark ci run time
  • Loading branch information
Taowyoo authored Dec 7, 2023
1 parent 003f727 commit 6849c5c
Show file tree
Hide file tree
Showing 12 changed files with 897 additions and 758 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,29 @@ jobs:
run: cargo test --locked --release --no-run --workspace

# TODO: add fuzz tests
# TODO: add benchmarks

benchmarks:
name: Run benchmarks
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Smoke-test benchmark program
run: cargo run -p rustls-mbedcrypto-provider --release --locked --example bench
env:
# Ensure benchmark does not take too long time
BENCH_MULTIPLIER: 0.3

- name: Run micro-benchmarks
run: cargo bench --locked --all-features
env:
RUSTFLAGS: --cfg=bench

docs:
name: Check for documentation errors
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions rustls-mbedcrypto-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ webpki-roots = "0.26.0"
rustls-pemfile = "2"
env_logger = "0.10"
log = { version = "0.4.4" }
bencher = "0.1.5"

[features]
default = ["logging", "tls12"]
Expand All @@ -57,3 +58,10 @@ path = "examples/client.rs"
[[example]]
name = "bench"
path = "examples/internal/bench.rs"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[package.metadata.cargo_check_external_types]
allowed_external_types = ["rustls_pki_types::*"]
Loading

0 comments on commit 6849c5c

Please sign in to comment.