aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Cargo.lock330
-rw-r--r--src/crates/candelabra/src/profiler/info.rs6
-rw-r--r--src/crates/candelabra/src/types.rs10
-rw-r--r--src/crates/cli/src/estimate.rs4
-rw-r--r--src/crates/cli/src/select.rs2
-rw-r--r--src/crates/primrose/Cargo.toml6
-rw-r--r--src/crates/primrose/benches/criterion_benchmark.rs235
7 files changed, 10 insertions, 583 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 45b658f..1c87acd 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -58,17 +58,6 @@ dependencies = [
]
[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi 0.1.19",
- "libc",
- "winapi",
-]
-
-[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -102,12 +91,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
-name = "bumpalo"
-version = "3.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
-
-[[package]]
name = "bytecount"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -191,117 +174,12 @@ dependencies = [
]
[[package]]
-name = "cast"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
-
-[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
-name = "clap"
-version = "2.34.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
-dependencies = [
- "bitflags 1.3.2",
- "textwrap",
- "unicode-width",
-]
-
-[[package]]
-name = "criterion"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f"
-dependencies = [
- "atty",
- "cast",
- "clap",
- "criterion-plot",
- "csv",
- "itertools",
- "lazy_static",
- "num-traits",
- "oorandom",
- "plotters",
- "rayon",
- "regex",
- "serde",
- "serde_cbor",
- "serde_derive",
- "serde_json",
- "tinytemplate",
- "walkdir",
-]
-
-[[package]]
-name = "criterion-plot"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876"
-dependencies = [
- "cast",
- "itertools",
-]
-
-[[package]]
-name = "crossbeam-deque"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
-dependencies = [
- "crossbeam-epoch",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-epoch"
-version = "0.9.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
-dependencies = [
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-utils"
-version = "0.8.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
-
-[[package]]
-name = "csv"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe"
-dependencies = [
- "csv-core",
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "csv-core"
-version = "0.1.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "either"
-version = "1.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
-
-[[package]]
name = "env_logger"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -354,12 +232,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
-name = "half"
-version = "1.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
-
-[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -367,15 +239,6 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[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.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
@@ -401,36 +264,18 @@ version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455"
dependencies = [
- "hermit-abi 0.3.4",
+ "hermit-abi",
"rustix",
"windows-sys",
]
[[package]]
-name = "itertools"
-version = "0.10.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
-dependencies = [
- "either",
-]
-
-[[package]]
name = "itoa"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
-name = "js-sys"
-version = "0.3.67"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1"
-dependencies = [
- "wasm-bindgen",
-]
-
-[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -544,18 +389,6 @@ dependencies = [
]
[[package]]
-name = "once_cell"
-version = "1.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
-
-[[package]]
-name = "oorandom"
-version = "11.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
-
-[[package]]
name = "papergrid"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -600,34 +433,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36bae92c60fa2398ce4678b98b2c4b5a7c61099961ca1fa305aec04a9ad28922"
[[package]]
-name = "plotters"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45"
-dependencies = [
- "num-traits",
- "plotters-backend",
- "plotters-svg",
- "wasm-bindgen",
- "web-sys",
-]
-
-[[package]]
-name = "plotters-backend"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609"
-
-[[package]]
-name = "plotters-svg"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab"
-dependencies = [
- "plotters-backend",
-]
-
-[[package]]
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -637,7 +442,6 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
name = "primrose"
version = "0.1.0"
dependencies = [
- "criterion",
"env_logger",
"log",
"peg",
@@ -769,26 +573,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
[[package]]
-name = "rayon"
-version = "1.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051"
-dependencies = [
- "either",
- "rayon-core",
-]
-
-[[package]]
-name = "rayon-core"
-version = "1.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
-dependencies = [
- "crossbeam-deque",
- "crossbeam-utils",
-]
-
-[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -876,15 +660,6 @@ dependencies = [
]
[[package]]
-name = "same-file"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -918,16 +693,6 @@ dependencies = [
]
[[package]]
-name = "serde_cbor"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
-dependencies = [
- "half",
- "serde",
-]
-
-[[package]]
name = "serde_derive"
version = "1.0.195"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1037,15 +802,6 @@ dependencies = [
]
[[package]]
-name = "textwrap"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-dependencies = [
- "unicode-width",
-]
-
-[[package]]
name = "thiserror"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1066,16 +822,6 @@ dependencies = [
]
[[package]]
-name = "tinytemplate"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
-dependencies = [
- "serde",
- "serde_json",
-]
-
-[[package]]
name = "typenum"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1115,86 +861,12 @@ dependencies = [
]
[[package]]
-name = "walkdir"
-version = "2.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
-dependencies = [
- "same-file",
- "winapi-util",
-]
-
-[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
-name = "wasm-bindgen"
-version = "0.2.90"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406"
-dependencies = [
- "cfg-if",
- "wasm-bindgen-macro",
-]
-
-[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.90"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd"
-dependencies = [
- "bumpalo",
- "log",
- "once_cell",
- "proc-macro2",
- "quote",
- "syn 2.0.48",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.90"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
-
-[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.90"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.48",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.90"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
-
-[[package]]
-name = "web-sys"
-version = "0.3.67"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
-[[package]]
name = "wide"
version = "0.7.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/src/crates/candelabra/src/profiler/info.rs b/src/crates/candelabra/src/profiler/info.rs
index f061e78..cde1e2c 100644
--- a/src/crates/candelabra/src/profiler/info.rs
+++ b/src/crates/candelabra/src/profiler/info.rs
@@ -56,7 +56,7 @@ impl UsageProfile {
name,
self.0
.iter()
- .map(|p| p.estimate_cost(&model))
+ .map(|p| p.estimate_cost(model))
.collect::<Vec<_>>(),
)
})
@@ -126,8 +126,8 @@ impl UsageProfile {
.find(|(name, _)| **name == after)
.unwrap()
.1;
- let not_switching_cost = &before_costs[split_idx..].iter().sum::<f64>()
- - &after_costs[split_idx..].iter().sum::<f64>();
+ let not_switching_cost = before_costs[split_idx..].iter().sum::<f64>()
+ - after_costs[split_idx..].iter().sum::<f64>();
debug!("Estimated switching cost: {}", switching_cost);
debug!("Estimated not switching cost: {}", not_switching_cost);
diff --git a/src/crates/candelabra/src/types.rs b/src/crates/candelabra/src/types.rs
index 3738cd6..bd54754 100644
--- a/src/crates/candelabra/src/types.rs
+++ b/src/crates/candelabra/src/types.rs
@@ -64,18 +64,14 @@ impl<A: Clone + Eq, B: Clone + Eq, C> Mapping2D<A, B, C> {
.flat_map(|(a, bs)| bs.iter().map(move |(b, _)| (a, b)))
}
- pub fn iter_2d<'a>(
- &'a self,
- ) -> impl Iterator<Item = (&'a A, impl Iterator<Item = (&'a B, &'a C)>)> {
+ pub fn iter_2d(&self) -> impl Iterator<Item = (&'_ A, impl Iterator<Item = (&'_ B, &'_ C)>)> {
self.0
.iter()
.map(|(a, bs)| (a, bs.iter().map(|(b, c)| (b, c))))
}
pub fn into_iter_2d(self) -> impl Iterator<Item = (A, impl Iterator<Item = (B, C)>)> {
- self.0
- .into_iter()
- .map(|(a, bs)| (a, bs.into_iter().map(|(b, c)| (b, c))))
+ self.0.into_iter().map(|(a, bs)| (a, bs.into_iter()))
}
pub(crate) fn iter_with_a(&self, target_a: &A) -> impl Iterator<Item = &(B, C)> {
@@ -125,7 +121,7 @@ pub enum EntryMut<'a, B, C> {
}
impl<'a, B: Clone, C> EntryMut<'a, B, C> {
- pub fn and_modify(&mut self, f: impl FnOnce(&mut C) -> ()) -> &mut Self {
+ pub fn and_modify(&mut self, f: impl FnOnce(&mut C)) -> &mut Self {
match self {
EntryMut::Occupied(c) => f(*c),
EntryMut::Vacant(_, _) => (),
diff --git a/src/crates/cli/src/estimate.rs b/src/crates/cli/src/estimate.rs
index 86e8d15..d559b62 100644
--- a/src/crates/cli/src/estimate.rs
+++ b/src/crates/cli/src/estimate.rs
@@ -37,7 +37,7 @@ impl State {
.assignments
.iter()
.step_by(3)
- .map(|p| Utf8PathBuf::from(p))
+ .map(Utf8PathBuf::from)
.zip(args.assignments.iter().skip(1).step_by(3))
.zip(args.assignments.iter().skip(2).step_by(3))
.collect::<Mapping2D<_, _, _>>();
@@ -71,7 +71,7 @@ impl State {
.get(f, *ctn)
.ok_or_else(|| anyhow!("no profiling info for {} / {} - wrong name?", f, ctn))?;
- let breakdown = profiler.cost_breakdown(&cost_model);
+ let breakdown = profiler.cost_breakdown(cost_model);
for (op, i) in breakdown {
acc.insert(&ctn_alias, op, i);
}
diff --git a/src/crates/cli/src/select.rs b/src/crates/cli/src/select.rs
index 1578c1a..fc3b812 100644
--- a/src/crates/cli/src/select.rs
+++ b/src/crates/cli/src/select.rs
@@ -71,7 +71,7 @@ impl State {
self.inner.run_benchmarks_with(
proj,
&assignment
- .into_iter()
+ .iter()
.map(|((f, ctn), i)| {
(
f.clone(),
diff --git a/src/crates/primrose/Cargo.toml b/src/crates/primrose/Cargo.toml
index 80dfdab..c54cb44 100644
--- a/src/crates/primrose/Cargo.toml
+++ b/src/crates/primrose/Cargo.toml
@@ -14,9 +14,3 @@ peg = "0.8.0"
primrose-library = { path = "../library" }
-[dev-dependencies]
-criterion = "0.3.5"
-
-[[bench]]
-name = "criterion_benchmark"
-harness = false
diff --git a/src/crates/primrose/benches/criterion_benchmark.rs b/src/crates/primrose/benches/criterion_benchmark.rs
deleted file mode 100644
index 6bdc214..0000000
--- a/src/crates/primrose/benches/criterion_benchmark.rs
+++ /dev/null
@@ -1,235 +0,0 @@
-use criterion::{criterion_group, criterion_main, Criterion};
-
-use primrose_library::traits::Container;
-use primrose_library::LazyUniqueVec;
-use rand::rngs::StdRng;
-use rand::seq::SliceRandom;
-
-use rand::SeedableRng;
-use std::collections::{BTreeSet, HashSet};
-use std::mem::size_of;
-
-use std::vec::Vec;
-
-// one search at the
-fn gen_dataset_1() -> Vec<u32> {
- // avoid duplication
- let size = 1024 * 1024; // 1 MB
- let amount = size / size_of::<u32>();
- let mut data: Vec<u32> = (1..amount as u32).collect(); //ensure no duplication
- let mut rng = StdRng::seed_from_u64(222);
- data.shuffle(&mut rng);
- data
-}
-
-fn gen_dataset_128() -> Vec<u32> {
- // avoid duplication
- let size = 128 * 1024 * 1024; // 128 MB
- let amount = size / size_of::<u32>();
- let mut data: Vec<u32> = (1..amount as u32).collect(); //ensure no duplication
- let mut rng = StdRng::seed_from_u64(222);
- data.shuffle(&mut rng);
- data
-}
-
-fn gen_dataset_256() -> Vec<u32> {
- // avoid duplication
- let size = 256 * 1024 * 1024; // 256 MB
- let amount = size / size_of::<u32>();
- let mut data: Vec<u32> = (1..amount as u32).collect(); //ensure no duplication
- let mut rng = StdRng::seed_from_u64(222);
- data.shuffle(&mut rng);
- data
-}
-
-fn gen_dataset_512() -> Vec<u32> {
- // avoid duplication
- let size = 512 * 1024 * 1024; // 512 MB
- let amount = size / size_of::<u32>();
- let mut data: Vec<u32> = (1..amount as u32).collect(); //ensure no duplication
- let mut rng = StdRng::seed_from_u64(222);
- data.shuffle(&mut rng);
- data
-}
-
-fn btreeset_insertion_1m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut BTreeSet::new();
- let data = gen_dataset_1();
- c.bench_function("btreeset insertion 1MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn btreeset_insertion_128m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut BTreeSet::new();
- let data = gen_dataset_128();
- c.bench_function("btreeset insertion 128MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn btreeset_insertion_256m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut BTreeSet::new();
- let data = gen_dataset_256();
- c.bench_function("btreeset insertion 256MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn btreeset_insertion_512m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut BTreeSet::new();
- let data = gen_dataset_512();
- c.bench_function("btreeset insertion 512MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn hashset_insertion_1m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut HashSet::new();
- let data = gen_dataset_1();
- c.bench_function("hashset insertion 1MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn hashset_insertion_128m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut HashSet::new();
- let data = gen_dataset_128();
- c.bench_function("hashset insertion 128MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn hashset_insertion_256m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut HashSet::new();
- let data = gen_dataset_256();
- c.bench_function("hashset insertion 256MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn hashset_insertion_512m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut HashSet::new();
- let data = gen_dataset_512();
- c.bench_function("hashset insertion 512MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn lazy_uniuqe_vec_insertion_1m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut LazyUniqueVec::new();
- let data = gen_dataset_1();
- c.bench_function("lazy unique vector insertion 1MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn lazy_uniuqe_vec_insertion_128m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut LazyUniqueVec::new();
- let data = gen_dataset_128();
- c.bench_function("lazy unique vector insertion 128MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn lazy_uniuqe_vec_insertion_256m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut LazyUniqueVec::new();
- let data = gen_dataset_256();
- c.bench_function("lazy unique vector insertion 256MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-fn lazy_uniuqe_vec_insertion_512m(c: &mut Criterion) {
- let s: &mut dyn Container<u32> = &mut LazyUniqueVec::new();
- let data = gen_dataset_512();
- c.bench_function("lazy unique vector insertion 512MB", |b| {
- b.iter(|| {
- for val in data.iter() {
- s.insert(*val);
- }
- s.contains(&1024);
- })
- });
-}
-
-criterion_group! {
- name = insertion_1m;
- config = Criterion::default().sample_size(10);
- targets = btreeset_insertion_1m, hashset_insertion_1m, lazy_uniuqe_vec_insertion_1m
-}
-
-criterion_group! {
- name = insertion_128m;
- config = Criterion::default().sample_size(10);
- targets = btreeset_insertion_128m, hashset_insertion_128m, lazy_uniuqe_vec_insertion_128m
-}
-
-criterion_group! {
- name = insertion_256m;
- config = Criterion::default().sample_size(10);
- targets = btreeset_insertion_256m, hashset_insertion_256m, lazy_uniuqe_vec_insertion_256m
-}
-
-criterion_group! {
- name = insertion_512m;
- config = Criterion::default().sample_size(10);
- targets = btreeset_insertion_512m, hashset_insertion_512m, lazy_uniuqe_vec_insertion_512m
-}
-
-criterion_main!(insertion_1m, insertion_128m, insertion_256m, insertion_512m);