From 4f9fe856a25ab29345b90e7725509e9ee38a37be Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:41 +0200 Subject: Adding upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/zerovec/benches/vzv.rs | 8 ++++---- vendor/zerovec/benches/zeromap.rs | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'vendor/zerovec/benches') diff --git a/vendor/zerovec/benches/vzv.rs b/vendor/zerovec/benches/vzv.rs index 3bee5add6..94b6621a9 100644 --- a/vendor/zerovec/benches/vzv.rs +++ b/vendor/zerovec/benches/vzv.rs @@ -102,7 +102,7 @@ fn binary_search_benches(c: &mut Criterion) { let (needles, _) = random_alphanums(2..=20, 10, seed); let bytes: Vec = VarZeroVec::::from(&string_vec).into_bytes(); let vzv = VarZeroVec::::parse_byte_slice(black_box(bytes.as_slice())).unwrap(); - let single_needle = "lmnop".to_string(); + let single_needle = "lmnop".to_owned(); // *** Binary search vec of 500 strings 10 times *** c.bench_function("vzv/binary_search/slice", |b| { @@ -169,7 +169,7 @@ fn vzv_precompute_bench(c: &mut Criterion) { let vzv = VarZeroVec::::parse_byte_slice(black_box(bytes.as_slice())).unwrap(); let borrowed = vzv.as_components(); let slice = vzv.as_slice(); - let single_needle = "lmnop".to_string(); + let single_needle = "lmnop"; c.bench_function("vzv_precompute/get/precomputed", |b| { b.iter(|| black_box(&borrowed).get(100)); @@ -180,11 +180,11 @@ fn vzv_precompute_bench(c: &mut Criterion) { }); c.bench_function("vzv_precompute/search/precomputed", |b| { - b.iter(|| black_box(&borrowed).binary_search(&single_needle)); + b.iter(|| black_box(&borrowed).binary_search(single_needle)); }); c.bench_function("vzv_precompute/search/slice", |b| { - b.iter(|| black_box(&slice).binary_search(&single_needle)); + b.iter(|| black_box(&slice).binary_search(single_needle)); }); c.bench_function("vzv_precompute/search_multi/precomputed", |b| { diff --git a/vendor/zerovec/benches/zeromap.rs b/vendor/zerovec/benches/zeromap.rs index 40225ba7a..069331979 100644 --- a/vendor/zerovec/benches/zeromap.rs +++ b/vendor/zerovec/benches/zeromap.rs @@ -56,7 +56,8 @@ const POSTCARD_HASHMAP: [u8; 176] = [ 114, 97, 98, 105, 99, ]; -/// Run this function to print new data to the console. Requires the optional `serde` feature. +/// Run this function to print new data to the console. +/// Requires the optional `serde` Cargo feature. #[allow(dead_code)] fn generate() { let map = build_zeromap(false); @@ -64,7 +65,8 @@ fn generate() { println!("{:?}", buf); } -/// Run this function to print new data to the console. Requires the optional `serde` feature. +/// Run this function to print new data to the console. +/// Requires the optional `serde` Cargo feature. #[allow(dead_code)] fn generate_hashmap() { let map = build_hashmap(false); @@ -180,13 +182,13 @@ fn bench_hashmap(c: &mut Criterion) { fn build_hashmap(large: bool) -> HashMap { let mut map: HashMap = HashMap::new(); - for (key, value) in DATA.iter() { + for &(key, value) in DATA.iter() { if large { for n in 0..8192 { - map.insert(format!("{}{}", key, n), value.to_string()); + map.insert(format!("{}{}", key, n), value.to_owned()); } } else { - map.insert(key.to_string(), value.to_string()); + map.insert(key.to_owned(), value.to_owned()); } } map @@ -197,7 +199,7 @@ fn bench_deserialize_hashmap(c: &mut Criterion) { b.iter(|| { let map: HashMap = postcard::from_bytes(black_box(&POSTCARD_HASHMAP)).unwrap(); - assert_eq!(map.get("iu"), Some(&"Inuktitut".to_string())); + assert_eq!(map.get("iu"), Some(&"Inuktitut".to_owned())); }) }); } @@ -207,7 +209,7 @@ fn bench_deserialize_large_hashmap(c: &mut Criterion) { c.bench_function("zeromap/deserialize/large/hashmap", |b| { b.iter(|| { let map: HashMap = postcard::from_bytes(black_box(&buf)).unwrap(); - assert_eq!(map.get("iu3333"), Some(&"Inuktitut".to_string())); + assert_eq!(map.get("iu3333"), Some(&"Inuktitut".to_owned())); }) }); } @@ -216,7 +218,7 @@ fn bench_lookup_hashmap(c: &mut Criterion) { let map: HashMap = postcard::from_bytes(black_box(&POSTCARD_HASHMAP)).unwrap(); c.bench_function("zeromap/lookup/small/hashmap", |b| { b.iter(|| { - assert_eq!(map.get(black_box("iu")), Some(&"Inuktitut".to_string())); + assert_eq!(map.get(black_box("iu")), Some(&"Inuktitut".to_owned())); assert_eq!(map.get(black_box("zz")), None); }); }); @@ -227,7 +229,7 @@ fn bench_lookup_large_hashmap(c: &mut Criterion) { let map: HashMap = postcard::from_bytes(&buf).unwrap(); c.bench_function("zeromap/lookup/large/hashmap", |b| { b.iter(|| { - assert_eq!(map.get(black_box("iu3333")), Some(&"Inuktitut".to_string())); + assert_eq!(map.get(black_box("iu3333")), Some(&"Inuktitut".to_owned())); assert_eq!(map.get(black_box("zz")), None); }); }); -- cgit v1.2.3