From 517d6e87d7fd41f050ce8d9ce1306874d54609b6 Mon Sep 17 00:00:00 2001 From: Coda Hale Date: Fri, 27 Oct 2023 18:27:35 -0600 Subject: [PATCH] perf(benchmarks): move benchmarks to a crate --- Cargo.lock | 11 +++++++++-- Cargo.toml | 9 ++------- benchmarks/Cargo.toml | 15 +++++++++++++++ {benches => benchmarks/benches}/benchmarks.rs | 0 xtask/Cargo.toml | 3 ++- xtask/src/xtask.rs | 2 +- 6 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 benchmarks/Cargo.toml rename {benches => benchmarks/benches}/benchmarks.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 0cc8f5c9..8f8dc657 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,6 +73,14 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "benchmarks" +version = "0.0.0" +dependencies = [ + "divan", + "lockstitch", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -400,7 +408,6 @@ version = "0.16.2" dependencies = [ "aes", "cmov", - "divan", "expect-test", "hex", "hex-literal", @@ -782,7 +789,7 @@ checksum = "7e2c411759b501fb9501aac2b1b2d287a6e93e5bdcf13c25306b23e1b716dd0e" [[package]] name = "xtask" -version = "0.1.0" +version = "0.0.0" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 390288f3..8e835a82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ documentation = "https://docs.rs/lockstitch/" keywords = ["crypto", "aegis-128l", "sha-256", "hazmat"] categories = ["cryptography", "no-std"] readme = "README.md" -include = ["src/**/*", "benches/**/*", "tests/**/*", "LICENSE", "README.md", "design.md", "perf.md"] +include = ["src/**/*", "tests/**/*", "LICENSE", "README.md", "design.md", "perf.md"] [dependencies] aes = { version = "0.8.3", features = ["hazmat"], optional = true } @@ -27,20 +27,15 @@ portable = ["aes"] std = [] [workspace] -members = ["xtask"] +members = ["benchmarks", "xtask"] [dev-dependencies] -divan = "0.1.1" expect-test = "1.4.1" hex = "0.4.3" hex-literal = "0.4.1" proptest = "1.3.1" rand = "0.8.5" -[[bench]] -name = "benchmarks" -harness = false - [package.metadata.docs.rs] all-features = true diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml new file mode 100644 index 00000000..e9148535 --- /dev/null +++ b/benchmarks/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "benchmarks" +version = "0.0.0" +publish = false +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +divan = "0.1.1" +lockstitch = { path = ".." } + +[[bench]] +name = "benchmarks" +harness = false diff --git a/benches/benchmarks.rs b/benchmarks/benches/benchmarks.rs similarity index 100% rename from benches/benchmarks.rs rename to benchmarks/benches/benchmarks.rs diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 9ce40c3b..efa54d2f 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "xtask" -version = "0.1.0" +version = "0.0.0" +publish = false edition = "2021" [dependencies] diff --git a/xtask/src/xtask.rs b/xtask/src/xtask.rs index 002fcbff..967c6d92 100644 --- a/xtask/src/xtask.rs +++ b/xtask/src/xtask.rs @@ -92,7 +92,7 @@ fn bench(sh: &Shell, args: Vec) -> Result<()> { #[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))] const RUSTFLAGS: &str = ""; - cmd!(sh, "cargo bench {args...}") + cmd!(sh, "cargo bench -p benchmarks {args...}") .env("RUSTFLAGS", RUSTFLAGS) .env("DIVAN_BYTES_FORMAT", "binary") .env("DIVAN_TIMER", "tsc")