Disable custom profiles (LTO is buggy on ppc64) and tests since

no_panic tests require LTO

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
epel9
Michel Alexandre Salim 2 years ago
parent f4545f3b1e
commit 602cc643b8
No known key found for this signature in database
GPG Key ID: 8B229D2F7CCC04F2

@ -1,11 +1,48 @@
--- ahash-0.7.6/Cargo.toml 1970-01-01T00:00:01+00:00 --- a/Cargo.toml
+++ ahash-0.7.6/Cargo.toml 2022-12-15T14:59:12.837183+00:00 +++ b/Cargo.toml
@@ -63,8 +63,6 @@ @@ -28,44 +28,15 @@ repository = "https://github.com/tkaitch
name = "map" features = ["std"]
path = "tests/map_tests.rs" rustc-args = ["-C", "target-feature=+aes"]
harness = false rustdoc-args = ["-C", "target-feature=+aes"]
-[profile.bench]
-opt-level = 3
-lto = "fat"
-codegen-units = 1
-debug = false
-debug-assertions = false
-
-[profile.release]
-opt-level = 3
-lto = "fat"
-codegen-units = 1
-debug = false
-debug-assertions = false
-
-[profile.test]
-opt-level = 2
-lto = "fat"
[lib]
name = "ahash"
path = "src/lib.rs"
test = true
doctest = true
-bench = true
+bench = false
doc = true
-[[bench]]
-name = "ahash"
-path = "tests/bench.rs"
-harness = false
-
-[[bench]]
-name = "map"
-path = "tests/map_tests.rs"
-harness = false
-[dev-dependencies.criterion] -[dev-dependencies.criterion]
-version = "0.3.2" -version = "0.3.2"
-
[dev-dependencies.fnv] [dev-dependencies.fnv]
version = "1.0.5" version = "1.0.5"

@ -1,183 +0,0 @@
--- a/tests/map_tests.rs
+++ b/tests/map_tests.rs
@@ -1,6 +1,5 @@
use std::hash::{BuildHasher, Hash, Hasher};
-use criterion::*;
use fxhash::FxHasher;
use ahash::{AHasher, CallHasher, RandomState};
@@ -188,16 +187,3 @@ fn fxhash_vec<H: Hash>(b: &Vec<H>) -> u6
}
total
}
-
-fn bench_ahash_words(c: &mut Criterion) {
- let words = gen_word_pairs();
- c.bench_function("aes_words", |b| b.iter(|| black_box(ahash_vec(&words))));
-}
-
-fn bench_fx_words(c: &mut Criterion) {
- let words = gen_word_pairs();
- c.bench_function("fx_words", |b| b.iter(|| black_box(fxhash_vec(&words))));
-}
-
-criterion_main!(benches);
-criterion_group!(benches, bench_ahash_words, bench_fx_words,);
--- a/tests/bench.rs
+++ /dev/null
@@ -1,154 +0,0 @@
-use ahash::{CallHasher, RandomState};
-use criterion::*;
-use fxhash::FxHasher;
-use std::collections::hash_map::DefaultHasher;
-use std::hash::{Hash, Hasher};
-
-#[cfg(any(
- all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
- all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "crypto", not(miri), feature = "stdsimd")
-))]
-fn aeshash<H: Hash>(b: &H) -> u64 {
- let build_hasher = RandomState::with_seeds(1, 2, 3, 4);
- H::get_hash(b, &build_hasher)
-}
-#[cfg(not(any(
- all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
- all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "crypto", not(miri), feature = "stdsimd")
-)))]
-fn aeshash<H: Hash>(_b: &H) -> u64 {
- panic!("aes must be enabled")
-}
-
-#[cfg(not(any(
- all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
- all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "crypto", not(miri), feature = "stdsimd")
-)))]
-fn fallbackhash<H: Hash>(b: &H) -> u64 {
- let build_hasher = RandomState::with_seeds(1, 2, 3, 4);
- H::get_hash(b, &build_hasher)
-}
-#[cfg(any(
- all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
- all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "crypto", not(miri), feature = "stdsimd")
-))]
-fn fallbackhash<H: Hash>(_b: &H) -> u64 {
- panic!("aes must be disabled")
-}
-
-fn fnvhash<H: Hash>(b: &H) -> u64 {
- let mut hasher = fnv::FnvHasher::default();
- b.hash(&mut hasher);
- hasher.finish()
-}
-
-fn siphash<H: Hash>(b: &H) -> u64 {
- let mut hasher = DefaultHasher::default();
- b.hash(&mut hasher);
- hasher.finish()
-}
-
-fn fxhash<H: Hash>(b: &H) -> u64 {
- let mut hasher = FxHasher::default();
- b.hash(&mut hasher);
- hasher.finish()
-}
-
-fn seahash<H: Hash>(b: &H) -> u64 {
- let mut hasher = seahash::SeaHasher::default();
- b.hash(&mut hasher);
- hasher.finish()
-}
-
-const STRING_LENGTHS: [u32; 12] = [1, 3, 4, 7, 8, 15, 16, 24, 33, 68, 132, 1024];
-
-fn gen_strings() -> Vec<String> {
- STRING_LENGTHS
- .iter()
- .map(|len| {
- let mut string = String::default();
- for pos in 1..=*len {
- let c = (48 + (pos % 10) as u8) as char;
- string.push(c);
- }
- string
- })
- .collect()
-}
-
-const U8_VALUE: u8 = 123;
-const U16_VALUE: u16 = 1234;
-const U32_VALUE: u32 = 12345678;
-const U64_VALUE: u64 = 1234567890123456;
-const U128_VALUE: u128 = 12345678901234567890123456789012;
-
-fn bench_ahash(c: &mut Criterion) {
- let mut group = c.benchmark_group("aeshash");
- group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
- group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
- group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
- group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
- group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
- group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(aeshash(s))));
-}
-
-fn bench_fallback(c: &mut Criterion) {
- let mut group = c.benchmark_group("fallback");
- group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
- group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
- group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
- group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
- group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
- group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(fallbackhash(s))));
-}
-
-fn bench_fx(c: &mut Criterion) {
- let mut group = c.benchmark_group("fx");
- group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
- group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
- group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
- group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
- group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
- group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(fxhash(s))));
-}
-
-fn bench_fnv(c: &mut Criterion) {
- let mut group = c.benchmark_group("fnv");
- group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
- group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
- group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
- group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
- group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
- group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(fnvhash(s))));
-}
-
-fn bench_sea(c: &mut Criterion) {
- let mut group = c.benchmark_group("sea");
- group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
- group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
- group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
- group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
- group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
- group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(seahash(s))));
-}
-
-fn bench_sip(c: &mut Criterion) {
- let mut group = c.benchmark_group("sip");
- group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
- group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
- group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
- group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
- group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
- group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(siphash(s))));
-}
-
-criterion_main!(benches);
-criterion_group!(
- benches,
- bench_ahash,
- bench_fallback,
- bench_fx,
- bench_fnv,
- bench_sea,
- bench_sip
-);

@ -1,5 +1,7 @@
# Generated by rust2rpm 23 # Generated by rust2rpm 23
%bcond_without check # * no_panic tests require LTO to work correctly, but LTO causes LLVM crashes:
# https://bugzilla.redhat.com/show_bug.cgi?id=2142648
%bcond_with check
%global debug_package %{nil} %global debug_package %{nil}
%global crate ahash %global crate ahash
@ -15,10 +17,9 @@ Source: %{crates_source}
# Automatically generated patch to strip foreign dependencies # Automatically generated patch to strip foreign dependencies
Patch: ahash-fix-metadata-auto.diff Patch: ahash-fix-metadata-auto.diff
# Manually created patch for downstream crate metadata changes # Manually created patch for downstream crate metadata changes
# - remove criterion dependency # * drop unused benchmarks and benchmark-only criterion dev-dependency
# * drop profiles which set incompatible compiler flags
Patch: ahash-fix-metadata.diff Patch: ahash-fix-metadata.diff
# Remove benchmark tests that use criterion
Patch: ahash-no-criterion.diff
BuildRequires: rust-packaging >= 21 BuildRequires: rust-packaging >= 21
@ -105,6 +106,9 @@ use the "std" feature of the "%{crate}" crate.
%prep %prep
%autosetup -n %{crate}-%{version_no_tilde} -p1 %autosetup -n %{crate}-%{version_no_tilde} -p1
# remove benchmark tests
rm tests/bench.rs
rm tests/map_tests.rs
%cargo_prep %cargo_prep
%generate_buildrequires %generate_buildrequires

Loading…
Cancel
Save