From d507f7e81bab94dc5e4a55702753e34b654e8a6d Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Fri, 28 Jul 2023 20:37:42 +0200 Subject: [PATCH 01/13] Upgrade criterion --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6c7ce73f66..539b153cc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,7 @@ rand_pcg = { path = "rand_pcg", version = "=0.9.0-alpha.1" } # Only to test serde1 bincode = "1.2.1" rayon = "1.5.3" -criterion = { version = "0.4" } +criterion = "0.5" [[bench]] name = "uniform" From 6f917e1f164a7e87e384931bf11969b07337dbdb Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Fri, 26 Apr 2024 14:20:51 +0200 Subject: [PATCH 02/13] Move rand benches to their own crate --- .github/workflows/test.yml | 2 +- Cargo.toml | 22 +------------ rand_benches/Cargo.toml | 32 +++++++++++++++++++ .../benches}/distributions.rs | 0 .../benches}/generators.rs | 0 {benches => rand_benches/benches}/misc.rs | 0 {benches => rand_benches/benches}/seq.rs | 0 .../benches}/seq_choose.rs | 0 {benches => rand_benches/benches}/shuffle.rs | 0 {benches => rand_benches/benches}/uniform.rs | 0 .../benches}/uniform_float.rs | 0 {benches => rand_benches/benches}/weighted.rs | 0 rand_benches/src/main.rs | 3 ++ 13 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 rand_benches/Cargo.toml rename {benches => rand_benches/benches}/distributions.rs (100%) rename {benches => rand_benches/benches}/generators.rs (100%) rename {benches => rand_benches/benches}/misc.rs (100%) rename {benches => rand_benches/benches}/seq.rs (100%) rename {benches => rand_benches/benches}/seq_choose.rs (100%) rename {benches => rand_benches/benches}/shuffle.rs (100%) rename {benches => rand_benches/benches}/uniform.rs (100%) rename {benches => rand_benches/benches}/uniform_float.rs (100%) rename {benches => rand_benches/benches}/weighted.rs (100%) create mode 100644 rand_benches/src/main.rs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1c5b39b61..f37ba69687 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,7 +79,7 @@ jobs: run: | cargo test --target ${{ matrix.target }} --features=nightly cargo test --target ${{ matrix.target }} --all-features - cargo test --target ${{ matrix.target }} --benches --features=small_rng,nightly + cargo test --target ${{ matrix.target }} --manifest-path rand_benches/Cargo.toml --benches --features=small_rng,nightly cargo test --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml --benches cargo test --target ${{ matrix.target }} --lib --tests --no-default-features - name: Test rand diff --git a/Cargo.toml b/Cargo.toml index 539b153cc2..b983a1222d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,6 +58,7 @@ unbiased = [] [workspace] members = [ + "rand_benches", "rand_core", "rand_distr", "rand_chacha", @@ -76,24 +77,3 @@ rand_pcg = { path = "rand_pcg", version = "=0.9.0-alpha.1" } # Only to test serde1 bincode = "1.2.1" rayon = "1.5.3" -criterion = "0.5" - -[[bench]] -name = "uniform" -path = "benches/uniform.rs" -harness = false - -[[bench]] -name = "seq_choose" -path = "benches/seq_choose.rs" -harness = false - -[[bench]] -name = "shuffle" -path = "benches/shuffle.rs" -harness = false - -[[bench]] -name = "uniform_float" -path = "benches/uniform_float.rs" -harness = false diff --git a/rand_benches/Cargo.toml b/rand_benches/Cargo.toml new file mode 100644 index 0000000000..7c7448612e --- /dev/null +++ b/rand_benches/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "rand_benches" +version = "0.1.0" +edition = "2021" + +[dependencies] + +[dev-dependencies] +rand = { path = "..", features = ["small_rng", "nightly"] } +rand_pcg = { path = "../rand_pcg" } +rand_chacha = { path = "../rand_chacha" } +criterion = "0.5" + +[[bench]] +name = "uniform" +path = "benches/uniform.rs" +harness = false + +[[bench]] +name = "seq_choose" +path = "benches/seq_choose.rs" +harness = false + +[[bench]] +name = "shuffle" +path = "benches/shuffle.rs" +harness = false + +[[bench]] +name = "uniform_float" +path = "benches/uniform_float.rs" +harness = false diff --git a/benches/distributions.rs b/rand_benches/benches/distributions.rs similarity index 100% rename from benches/distributions.rs rename to rand_benches/benches/distributions.rs diff --git a/benches/generators.rs b/rand_benches/benches/generators.rs similarity index 100% rename from benches/generators.rs rename to rand_benches/benches/generators.rs diff --git a/benches/misc.rs b/rand_benches/benches/misc.rs similarity index 100% rename from benches/misc.rs rename to rand_benches/benches/misc.rs diff --git a/benches/seq.rs b/rand_benches/benches/seq.rs similarity index 100% rename from benches/seq.rs rename to rand_benches/benches/seq.rs diff --git a/benches/seq_choose.rs b/rand_benches/benches/seq_choose.rs similarity index 100% rename from benches/seq_choose.rs rename to rand_benches/benches/seq_choose.rs diff --git a/benches/shuffle.rs b/rand_benches/benches/shuffle.rs similarity index 100% rename from benches/shuffle.rs rename to rand_benches/benches/shuffle.rs diff --git a/benches/uniform.rs b/rand_benches/benches/uniform.rs similarity index 100% rename from benches/uniform.rs rename to rand_benches/benches/uniform.rs diff --git a/benches/uniform_float.rs b/rand_benches/benches/uniform_float.rs similarity index 100% rename from benches/uniform_float.rs rename to rand_benches/benches/uniform_float.rs diff --git a/benches/weighted.rs b/rand_benches/benches/weighted.rs similarity index 100% rename from benches/weighted.rs rename to rand_benches/benches/weighted.rs diff --git a/rand_benches/src/main.rs b/rand_benches/src/main.rs new file mode 100644 index 0000000000..cf98dd1b9f --- /dev/null +++ b/rand_benches/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Please use `cargo bench` to run the benchmarks instead."); +} From 9855f379306def0198cb1020dede60afb47322c2 Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Fri, 26 Apr 2024 14:22:00 +0200 Subject: [PATCH 03/13] Pin rayon and rayon-core to support MSRV 1.61 --- Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b983a1222d..0ec32ee583 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,4 +76,5 @@ zerocopy = { version = "=0.8.0-alpha.6", default-features = false, features = [" rand_pcg = { path = "rand_pcg", version = "=0.9.0-alpha.1" } # Only to test serde1 bincode = "1.2.1" -rayon = "1.5.3" +rayon = "=1.7" +rayon-core = "=1.11" From 0935356be9e0c3b057fafa12dd258a0b10a4ea92 Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Fri, 26 Apr 2024 14:25:51 +0200 Subject: [PATCH 04/13] Fix benches test in pipeline --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f37ba69687..ee1f2032f1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,7 +79,7 @@ jobs: run: | cargo test --target ${{ matrix.target }} --features=nightly cargo test --target ${{ matrix.target }} --all-features - cargo test --target ${{ matrix.target }} --manifest-path rand_benches/Cargo.toml --benches --features=small_rng,nightly + cargo test --target ${{ matrix.target }} --manifest-path rand_benches/Cargo.toml --benches cargo test --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml --benches cargo test --target ${{ matrix.target }} --lib --tests --no-default-features - name: Test rand From 13620d9775195dc11f7a60e5549970d00b0ff72e Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 08:22:51 +0100 Subject: [PATCH 05/13] Test feature serde1 on rand_chacha --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ee1f2032f1..3ed7c92ae3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -104,7 +104,7 @@ jobs: - name: Test rand_pcg run: cargo test --target ${{ matrix.target }} --manifest-path rand_pcg/Cargo.toml --features=serde1 - name: Test rand_chacha - run: cargo test --target ${{ matrix.target }} --manifest-path rand_chacha/Cargo.toml + run: cargo test --target ${{ matrix.target }} --manifest-path rand_chacha/Cargo.toml --features=serde1 test-cross: runs-on: ${{ matrix.os }} From f6ac90fc8de7ebaf35d0b5f910d8287b0112a0d6 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 08:28:41 +0100 Subject: [PATCH 06/13] Updated Cargo.lock.msrv --- Cargo.lock.msrv | 118 +++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 61 deletions(-) diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index 0a197d12e0..043f11775f 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -33,15 +33,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] -name = "atty" -version = "0.2.14" +name = "anstyle" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "autocfg" @@ -51,9 +46,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "average" -version = "0.14.1" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d804c74bb2d66e9b7047658d21af0f1c937d7d2466410cbf1aed3b0c04048d4" +checksum = "3a237a6822e1c3c98e700b6db5b293eb341b7524dcb8d227941245702b7431dc" dependencies = [ "easy-cast", "float-ord", @@ -75,12 +70,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "bumpalo" version = "3.15.4" @@ -147,25 +136,29 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.25" +version = "4.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" dependencies = [ - "bitflags", - "clap_lex", - "indexmap 1.9.3", - "textwrap", + "clap_builder", ] [[package]] -name = "clap_lex" -version = "0.2.4" +name = "clap_builder" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" dependencies = [ - "os_str_bytes", + "anstyle", + "clap_lex", ] +[[package]] +name = "clap_lex" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" + [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -174,19 +167,19 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "criterion" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" dependencies = [ "anes", - "atty", "cast", "ciborium", "clap", "criterion-plot", + "is-terminal", "itertools", - "lazy_static", "num-traits", + "once_cell", "oorandom", "plotters", "rayon", @@ -358,15 +351,6 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.9" @@ -430,6 +414,17 @@ dependencies = [ "serde", ] +[[package]] +name = "is-terminal" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys", +] + [[package]] name = "itertools" version = "0.10.5" @@ -454,12 +449,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - [[package]] name = "libc" version = "0.2.153" @@ -506,7 +495,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.9", + "hermit-abi", "libc", ] @@ -522,12 +511,6 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -[[package]] -name = "os_str_bytes" -version = "6.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" - [[package]] name = "plotters" version = "0.3.5" @@ -591,16 +574,26 @@ name = "rand" version = "0.9.0-alpha.1" dependencies = [ "bincode", - "criterion", "log", "rand_chacha", "rand_core", "rand_pcg", "rayon", + "rayon-core", "serde", "zerocopy", ] +[[package]] +name = "rand_benches" +version = "0.1.0" +dependencies = [ + "criterion", + "rand", + "rand_chacha", + "rand_pcg", +] + [[package]] name = "rand_chacha" version = "0.9.0-alpha.1" @@ -644,9 +637,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ "either", "rayon-core", @@ -795,12 +788,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "textwrap" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" - [[package]] name = "time" version = "0.3.34" @@ -968,6 +955,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.52.4" From 47d0b54f79edd5257d490c0d96dd5191afacee0b Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 08:29:54 +0100 Subject: [PATCH 07/13] Remove pin on Rayon versions --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0ec32ee583..9930e5cf6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,5 +76,5 @@ zerocopy = { version = "=0.8.0-alpha.6", default-features = false, features = [" rand_pcg = { path = "rand_pcg", version = "=0.9.0-alpha.1" } # Only to test serde1 bincode = "1.2.1" -rayon = "=1.7" -rayon-core = "=1.11" +rayon = "1.7" +rayon-core = "1.11" From 3c0661b8044b507765639ed361e20c6ca16f1a7f Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 08:40:53 +0100 Subject: [PATCH 08/13] Rename rand_benches -> benches --- Cargo.toml | 2 +- {rand_benches => benches}/Cargo.toml | 3 ++- {rand_benches => benches}/benches/distributions.rs | 0 {rand_benches => benches}/benches/generators.rs | 0 {rand_benches => benches}/benches/misc.rs | 0 {rand_benches => benches}/benches/seq.rs | 0 {rand_benches => benches}/benches/seq_choose.rs | 0 {rand_benches => benches}/benches/shuffle.rs | 0 {rand_benches => benches}/benches/uniform.rs | 0 {rand_benches => benches}/benches/uniform_float.rs | 0 {rand_benches => benches}/benches/weighted.rs | 0 {rand_benches => benches}/src/main.rs | 0 12 files changed, 3 insertions(+), 2 deletions(-) rename {rand_benches => benches}/Cargo.toml (94%) rename {rand_benches => benches}/benches/distributions.rs (100%) rename {rand_benches => benches}/benches/generators.rs (100%) rename {rand_benches => benches}/benches/misc.rs (100%) rename {rand_benches => benches}/benches/seq.rs (100%) rename {rand_benches => benches}/benches/seq_choose.rs (100%) rename {rand_benches => benches}/benches/shuffle.rs (100%) rename {rand_benches => benches}/benches/uniform.rs (100%) rename {rand_benches => benches}/benches/uniform_float.rs (100%) rename {rand_benches => benches}/benches/weighted.rs (100%) rename {rand_benches => benches}/src/main.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 9930e5cf6f..10ff97c919 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,7 +58,7 @@ unbiased = [] [workspace] members = [ - "rand_benches", + "benches", "rand_core", "rand_distr", "rand_chacha", diff --git a/rand_benches/Cargo.toml b/benches/Cargo.toml similarity index 94% rename from rand_benches/Cargo.toml rename to benches/Cargo.toml index 7c7448612e..ddc141728e 100644 --- a/rand_benches/Cargo.toml +++ b/benches/Cargo.toml @@ -1,7 +1,8 @@ [package] -name = "rand_benches" +name = "benches" version = "0.1.0" edition = "2021" +publish = false [dependencies] diff --git a/rand_benches/benches/distributions.rs b/benches/benches/distributions.rs similarity index 100% rename from rand_benches/benches/distributions.rs rename to benches/benches/distributions.rs diff --git a/rand_benches/benches/generators.rs b/benches/benches/generators.rs similarity index 100% rename from rand_benches/benches/generators.rs rename to benches/benches/generators.rs diff --git a/rand_benches/benches/misc.rs b/benches/benches/misc.rs similarity index 100% rename from rand_benches/benches/misc.rs rename to benches/benches/misc.rs diff --git a/rand_benches/benches/seq.rs b/benches/benches/seq.rs similarity index 100% rename from rand_benches/benches/seq.rs rename to benches/benches/seq.rs diff --git a/rand_benches/benches/seq_choose.rs b/benches/benches/seq_choose.rs similarity index 100% rename from rand_benches/benches/seq_choose.rs rename to benches/benches/seq_choose.rs diff --git a/rand_benches/benches/shuffle.rs b/benches/benches/shuffle.rs similarity index 100% rename from rand_benches/benches/shuffle.rs rename to benches/benches/shuffle.rs diff --git a/rand_benches/benches/uniform.rs b/benches/benches/uniform.rs similarity index 100% rename from rand_benches/benches/uniform.rs rename to benches/benches/uniform.rs diff --git a/rand_benches/benches/uniform_float.rs b/benches/benches/uniform_float.rs similarity index 100% rename from rand_benches/benches/uniform_float.rs rename to benches/benches/uniform_float.rs diff --git a/rand_benches/benches/weighted.rs b/benches/benches/weighted.rs similarity index 100% rename from rand_benches/benches/weighted.rs rename to benches/benches/weighted.rs diff --git a/rand_benches/src/main.rs b/benches/src/main.rs similarity index 100% rename from rand_benches/src/main.rs rename to benches/src/main.rs From 24b84a09a1c49f8b6e2fe8cf2a3081ba5dfa3c66 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 08:43:47 +0100 Subject: [PATCH 09/13] Move Criterion benches to benches/src --- benches/Cargo.toml | 8 ++++---- benches/src/main.rs | 3 --- benches/{benches => src}/seq_choose.rs | 0 benches/{benches => src}/shuffle.rs | 0 benches/{benches => src}/uniform.rs | 0 benches/{benches => src}/uniform_float.rs | 0 6 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 benches/src/main.rs rename benches/{benches => src}/seq_choose.rs (100%) rename benches/{benches => src}/shuffle.rs (100%) rename benches/{benches => src}/uniform.rs (100%) rename benches/{benches => src}/uniform_float.rs (100%) diff --git a/benches/Cargo.toml b/benches/Cargo.toml index ddc141728e..50b7640546 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -14,20 +14,20 @@ criterion = "0.5" [[bench]] name = "uniform" -path = "benches/uniform.rs" +path = "src/uniform.rs" harness = false [[bench]] name = "seq_choose" -path = "benches/seq_choose.rs" +path = "src/seq_choose.rs" harness = false [[bench]] name = "shuffle" -path = "benches/shuffle.rs" +path = "src/shuffle.rs" harness = false [[bench]] name = "uniform_float" -path = "benches/uniform_float.rs" +path = "src/uniform_float.rs" harness = false diff --git a/benches/src/main.rs b/benches/src/main.rs deleted file mode 100644 index cf98dd1b9f..0000000000 --- a/benches/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Please use `cargo bench` to run the benchmarks instead."); -} diff --git a/benches/benches/seq_choose.rs b/benches/src/seq_choose.rs similarity index 100% rename from benches/benches/seq_choose.rs rename to benches/src/seq_choose.rs diff --git a/benches/benches/shuffle.rs b/benches/src/shuffle.rs similarity index 100% rename from benches/benches/shuffle.rs rename to benches/src/shuffle.rs diff --git a/benches/benches/uniform.rs b/benches/src/uniform.rs similarity index 100% rename from benches/benches/uniform.rs rename to benches/src/uniform.rs diff --git a/benches/benches/uniform_float.rs b/benches/src/uniform_float.rs similarity index 100% rename from benches/benches/uniform_float.rs rename to benches/src/uniform_float.rs From e55b1f6ee5db1115ab4a105d6295b846edec6779 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 08:59:58 +0100 Subject: [PATCH 10/13] Merge rand_distr/benches into benches --- benches/Cargo.toml | 7 ++++++ ...distributions.rs => base_distributions.rs} | 0 .../benches => benches}/src/distributions.rs | 0 rand_distr/benches/Cargo.toml | 23 ------------------- 4 files changed, 7 insertions(+), 23 deletions(-) rename benches/benches/{distributions.rs => base_distributions.rs} (100%) rename {rand_distr/benches => benches}/src/distributions.rs (100%) delete mode 100644 rand_distr/benches/Cargo.toml diff --git a/benches/Cargo.toml b/benches/Cargo.toml index 50b7640546..b3068c2f75 100644 --- a/benches/Cargo.toml +++ b/benches/Cargo.toml @@ -10,7 +10,14 @@ publish = false rand = { path = "..", features = ["small_rng", "nightly"] } rand_pcg = { path = "../rand_pcg" } rand_chacha = { path = "../rand_chacha" } +rand_distr = { path = "../rand_distr" } criterion = "0.5" +criterion-cycles-per-byte = "0.6" + +[[bench]] +name = "distributions" +path = "src/distributions.rs" +harness = false [[bench]] name = "uniform" diff --git a/benches/benches/distributions.rs b/benches/benches/base_distributions.rs similarity index 100% rename from benches/benches/distributions.rs rename to benches/benches/base_distributions.rs diff --git a/rand_distr/benches/src/distributions.rs b/benches/src/distributions.rs similarity index 100% rename from rand_distr/benches/src/distributions.rs rename to benches/src/distributions.rs diff --git a/rand_distr/benches/Cargo.toml b/rand_distr/benches/Cargo.toml deleted file mode 100644 index e9c41c3154..0000000000 --- a/rand_distr/benches/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "benches" -version = "0.0.0" -authors = ["The Rand Project Developers"] -license = "MIT OR Apache-2.0" -description = "Criterion benchmarks of the rand_distr crate" -edition = "2021" -rust-version = "1.61" -publish = false - -[workspace] - -[dependencies] -criterion = { version = "0.3", features = ["html_reports"] } -criterion-cycles-per-byte = "0.1" -rand = { path = "../../" } -rand_distr = { path = "../" } -rand_pcg = { path = "../../rand_pcg/" } - -[[bench]] -name = "distributions" -path = "src/distributions.rs" -harness = false From 75a233b02a5941dbf46fdb8fe3895336263f61a8 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 09:06:46 +0100 Subject: [PATCH 11/13] Add note to CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9019ae4b8b..ba7fd2d7a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ You may also find the [Upgrade Guide](https://rust-random.github.io/book/update. ## [Unreleased] - Add `rand::distributions::WeightedIndex::{weight, weights, total_weight}` (#1420) - Bump the MSRV to 1.61.0 +- Move all benchmarks to new `benches` crate (#1439) ## [0.9.0-alpha.1] - 2024-03-18 - Add the `Slice::num_choices` method to the Slice distribution (#1402) From 6389320091bc71328e2873a4658a92b8745d41b3 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 09:17:29 +0100 Subject: [PATCH 12/13] Update Cargo.lock.msrv again --- Cargo.lock.msrv | 32 +++++++++++++++++++++----------- Cargo.toml | 1 - 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Cargo.lock.msrv b/Cargo.lock.msrv index 043f11775f..bf15ecb24d 100644 --- a/Cargo.lock.msrv +++ b/Cargo.lock.msrv @@ -61,6 +61,18 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "benches" +version = "0.1.0" +dependencies = [ + "criterion", + "criterion-cycles-per-byte", + "rand", + "rand_chacha", + "rand_distr", + "rand_pcg", +] + [[package]] name = "bincode" version = "1.3.3" @@ -191,6 +203,15 @@ dependencies = [ "walkdir", ] +[[package]] +name = "criterion-cycles-per-byte" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5281161544b8f2397e14942c2045efa3446470348121a65c37263f8e76c1e2ff" +dependencies = [ + "criterion", +] + [[package]] name = "criterion-plot" version = "0.5.0" @@ -579,21 +600,10 @@ dependencies = [ "rand_core", "rand_pcg", "rayon", - "rayon-core", "serde", "zerocopy", ] -[[package]] -name = "rand_benches" -version = "0.1.0" -dependencies = [ - "criterion", - "rand", - "rand_chacha", - "rand_pcg", -] - [[package]] name = "rand_chacha" version = "0.9.0-alpha.1" diff --git a/Cargo.toml b/Cargo.toml index 10ff97c919..48f8719e29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,4 +77,3 @@ rand_pcg = { path = "rand_pcg", version = "=0.9.0-alpha.1" } # Only to test serde1 bincode = "1.2.1" rayon = "1.7" -rayon-core = "1.11" From bf0301bfe6d2360e6c86a6c58273f7069f027691 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 27 Apr 2024 09:25:00 +0100 Subject: [PATCH 13/13] Fix test.yml --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ed7c92ae3..495571d262 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -79,8 +79,7 @@ jobs: run: | cargo test --target ${{ matrix.target }} --features=nightly cargo test --target ${{ matrix.target }} --all-features - cargo test --target ${{ matrix.target }} --manifest-path rand_benches/Cargo.toml --benches - cargo test --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml --benches + cargo test --target ${{ matrix.target }} --manifest-path benches/Cargo.toml --benches cargo test --target ${{ matrix.target }} --lib --tests --no-default-features - name: Test rand run: |