Codebase list rust-subtle / 7becc8b
package ahash that is needed for cursive, that is needed for ripasso Alexander Kjäll 2 years ago
9 changed file(s) with 566 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
(New empty file)
0 rust-ahash (0.7.6-1) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Package ahash 0.7.6 from crates.io using debcargo 2.5.0
3
4 -- Alexander Kjäll <alexander.kjall@gmail.com> Mon, 14 Mar 2022 16:59:09 +0100
0 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
1 Upstream-Name: ahash
2 Upstream-Contact: Tom Kaitchuck <Tom.Kaitchuck@gmail.com>
3 Source: https://github.com/tkaitchuck/ahash
4
5 Files: *
6 Copyright: 2019-2022 Tom Kaitchuck <Tom.Kaitchuck@gmail.com>
7 License: MIT or Apache-2.0
8
9 Files: debian/*
10 Copyright:
11 2022 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
12 2022 Alexander Kjäll <alexander.kjall@gmail.com>
13 License: MIT or Apache-2.0
14
15 License: Apache-2.0
16 Debian systems provide the Apache 2.0 license in
17 /usr/share/common-licenses/Apache-2.0
18
19 License: MIT
20 Permission is hereby granted, free of charge, to any person obtaining a copy
21 of this software and associated documentation files (the "Software"), to deal
22 in the Software without restriction, including without limitation the rights
23 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24 copies of the Software, and to permit persons to whom the Software is
25 furnished to do so, subject to the following conditions:
26 .
27 The above copyright notice and this permission notice shall be included in all
28 copies or substantial portions of the Software.
29 .
30 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36 SOFTWARE.
0 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
1 Upstream-Name: ahash
2 Upstream-Contact: Tom Kaitchuck <Tom.Kaitchuck@gmail.com>
3 Source: https://github.com/tkaitchuck/ahash
4
5 Files: *
6 Copyright: FIXME (overlay) UNKNOWN-YEARS Tom Kaitchuck <Tom.Kaitchuck@gmail.com>
7 License: MIT or Apache-2.0
8 Comment:
9 FIXME (overlay): Since upstream copyright years are not available in
10 Cargo.toml, they were extracted from the upstream Git repository. This may not
11 be correct information so you should review and fix this before uploading to
12 the archive.
13
14 Files: ./LICENSE-MIT
15 Copyright: 2016 Amanieu d'Antras
16 License: UNKNOWN-LICENSE; FIXME (overlay)
17 Comment:
18 FIXME (overlay): These notices are extracted from files. Please review them
19 before uploading to the archive.
20
21 Files: debian/*
22 Copyright:
23 2022 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
24 2022 Alexander Kjäll <alexander.kjall@gmail.com>
25 License: MIT or Apache-2.0
26
27 License: Apache-2.0
28 Debian systems provide the Apache 2.0 license in
29 /usr/share/common-licenses/Apache-2.0
30
31 License: MIT
32 Permission is hereby granted, free of charge, to any person obtaining a copy
33 of this software and associated documentation files (the "Software"), to deal
34 in the Software without restriction, including without limitation the rights
35 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36 copies of the Software, and to permit persons to whom the Software is
37 furnished to do so, subject to the following conditions:
38 .
39 The above copyright notice and this permission notice shall be included in all
40 copies or substantial portions of the Software.
41 .
42 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
48 SOFTWARE.
0 overlay = "."
1 uploaders = ["Alexander Kjäll <alexander.kjall@gmail.com>"]
0 diff --git a/Cargo.toml b/Cargo.toml
1 index ce96a26..0c1f864 100644
2 --- a/Cargo.toml
3 +++ b/Cargo.toml
4 @@ -55,25 +55,25 @@ bench = true
5 doc = true
6
7 [dev-dependencies.fnv]
8 -version = "1.0.5"
9 +version = "1"
10
11 [dev-dependencies.fxhash]
12 version = "0.2.1"
13
14 [dev-dependencies.hex]
15 -version = "0.4.2"
16 +version = "0.4"
17
18 [dev-dependencies.no-panic]
19 -version = "0.1.10"
20 +version = "0.1"
21
22 [dev-dependencies.rand]
23 version = "0.8"
24
25 [dev-dependencies.seahash]
26 -version = "4.0"
27 +version = "4"
28
29 [dev-dependencies.serde_json]
30 -version = "1.0.59"
31 +version = "1"
32 [build-dependencies.version_check]
33 version = "0.9"
34
35 @@ -82,23 +82,23 @@ compile-time-rng = ["const-random"]
36 default = ["std"]
37 std = []
38 [target."cfg(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\"))".dependencies.const-random]
39 -version = "0.1.12"
40 +version = "0.1"
41 optional = true
42
43 [target."cfg(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\"))".dependencies.getrandom]
44 -version = "0.2.3"
45 +version = "0.2"
46
47 [target."cfg(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\"))".dependencies.serde]
48 -version = "1.0.117"
49 +version = "1"
50 optional = true
51 [target."cfg(not(all(target_arch = \"arm\", target_os = \"none\")))".dependencies.once_cell]
52 -version = "1.8"
53 +version = "1"
54 features = ["alloc"]
55 default-features = false
56 [target."cfg(not(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\")))".dependencies.const-random]
57 -version = "0.1.12"
58 +version = "0.1"
59 optional = true
60
61 [target."cfg(not(any(target_os = \"linux\", target_os = \"android\", target_os = \"windows\", target_os = \"macos\", target_os = \"ios\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\", target_os = \"solaris\", target_os = \"illumos\", target_os = \"fuchsia\", target_os = \"redox\", target_os = \"cloudabi\", target_os = \"haiku\", target_os = \"vxworks\", target_os = \"emscripten\", target_os = \"wasi\")))".dependencies.serde]
62 -version = "1.0.117"
63 +version = "1"
64 optional = true
0 diff --git a/Cargo.toml b/Cargo.toml
1 index b412f79..9d5c5b7 100644
2 --- a/Cargo.toml
3 +++ b/Cargo.toml
4 @@ -54,18 +54,6 @@ doctest = true
5 bench = true
6 doc = true
7
8 -[[bench]]
9 -name = "ahash"
10 -path = "tests/bench.rs"
11 -harness = false
12 -
13 -[[bench]]
14 -name = "map"
15 -path = "tests/map_tests.rs"
16 -harness = false
17 -[dev-dependencies.criterion]
18 -version = "0.3.2"
19 -
20 [dev-dependencies.fnv]
21 version = "1.0.5"
22
23 diff --git a/tests/bench.rs b/tests/bench.rs
24 deleted file mode 100644
25 index 9e6dccc..0000000
26 --- a/tests/bench.rs
27 +++ /dev/null
28 @@ -1,154 +0,0 @@
29 -use ahash::{CallHasher, RandomState};
30 -use criterion::*;
31 -use fxhash::FxHasher;
32 -use std::collections::hash_map::DefaultHasher;
33 -use std::hash::{Hash, Hasher};
34 -
35 -#[cfg(any(
36 - all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
37 - all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "crypto", not(miri), feature = "stdsimd")
38 -))]
39 -fn aeshash<H: Hash>(b: &H) -> u64 {
40 - let build_hasher = RandomState::with_seeds(1, 2, 3, 4);
41 - H::get_hash(b, &build_hasher)
42 -}
43 -#[cfg(not(any(
44 - all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
45 - all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "crypto", not(miri), feature = "stdsimd")
46 -)))]
47 -fn aeshash<H: Hash>(_b: &H) -> u64 {
48 - panic!("aes must be enabled")
49 -}
50 -
51 -#[cfg(not(any(
52 - all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
53 - all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "crypto", not(miri), feature = "stdsimd")
54 -)))]
55 -fn fallbackhash<H: Hash>(b: &H) -> u64 {
56 - let build_hasher = RandomState::with_seeds(1, 2, 3, 4);
57 - H::get_hash(b, &build_hasher)
58 -}
59 -#[cfg(any(
60 - all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
61 - all(any(target_arch = "arm", target_arch = "aarch64"), target_feature = "crypto", not(miri), feature = "stdsimd")
62 -))]
63 -fn fallbackhash<H: Hash>(_b: &H) -> u64 {
64 - panic!("aes must be disabled")
65 -}
66 -
67 -fn fnvhash<H: Hash>(b: &H) -> u64 {
68 - let mut hasher = fnv::FnvHasher::default();
69 - b.hash(&mut hasher);
70 - hasher.finish()
71 -}
72 -
73 -fn siphash<H: Hash>(b: &H) -> u64 {
74 - let mut hasher = DefaultHasher::default();
75 - b.hash(&mut hasher);
76 - hasher.finish()
77 -}
78 -
79 -fn fxhash<H: Hash>(b: &H) -> u64 {
80 - let mut hasher = FxHasher::default();
81 - b.hash(&mut hasher);
82 - hasher.finish()
83 -}
84 -
85 -fn seahash<H: Hash>(b: &H) -> u64 {
86 - let mut hasher = seahash::SeaHasher::default();
87 - b.hash(&mut hasher);
88 - hasher.finish()
89 -}
90 -
91 -const STRING_LENGTHS: [u32; 12] = [1, 3, 4, 7, 8, 15, 16, 24, 33, 68, 132, 1024];
92 -
93 -fn gen_strings() -> Vec<String> {
94 - STRING_LENGTHS
95 - .iter()
96 - .map(|len| {
97 - let mut string = String::default();
98 - for pos in 1..=*len {
99 - let c = (48 + (pos % 10) as u8) as char;
100 - string.push(c);
101 - }
102 - string
103 - })
104 - .collect()
105 -}
106 -
107 -const U8_VALUE: u8 = 123;
108 -const U16_VALUE: u16 = 1234;
109 -const U32_VALUE: u32 = 12345678;
110 -const U64_VALUE: u64 = 1234567890123456;
111 -const U128_VALUE: u128 = 12345678901234567890123456789012;
112 -
113 -fn bench_ahash(c: &mut Criterion) {
114 - let mut group = c.benchmark_group("aeshash");
115 - group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
116 - group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
117 - group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
118 - group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
119 - group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(aeshash(s))));
120 - group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(aeshash(s))));
121 -}
122 -
123 -fn bench_fallback(c: &mut Criterion) {
124 - let mut group = c.benchmark_group("fallback");
125 - group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
126 - group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
127 - group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
128 - group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
129 - group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(fallbackhash(s))));
130 - group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(fallbackhash(s))));
131 -}
132 -
133 -fn bench_fx(c: &mut Criterion) {
134 - let mut group = c.benchmark_group("fx");
135 - group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
136 - group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
137 - group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
138 - group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
139 - group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(fxhash(s))));
140 - group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(fxhash(s))));
141 -}
142 -
143 -fn bench_fnv(c: &mut Criterion) {
144 - let mut group = c.benchmark_group("fnv");
145 - group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
146 - group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
147 - group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
148 - group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
149 - group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(fnvhash(s))));
150 - group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(fnvhash(s))));
151 -}
152 -
153 -fn bench_sea(c: &mut Criterion) {
154 - let mut group = c.benchmark_group("sea");
155 - group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
156 - group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
157 - group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
158 - group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
159 - group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(seahash(s))));
160 - group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(seahash(s))));
161 -}
162 -
163 -fn bench_sip(c: &mut Criterion) {
164 - let mut group = c.benchmark_group("sip");
165 - group.bench_with_input("u8", &U8_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
166 - group.bench_with_input("u16", &U16_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
167 - group.bench_with_input("u32", &U32_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
168 - group.bench_with_input("u64", &U64_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
169 - group.bench_with_input("u128", &U128_VALUE, |b, s| b.iter(|| black_box(siphash(s))));
170 - group.bench_with_input("string", &gen_strings(), |b, s| b.iter(|| black_box(siphash(s))));
171 -}
172 -
173 -criterion_main!(benches);
174 -criterion_group!(
175 - benches,
176 - bench_ahash,
177 - bench_fallback,
178 - bench_fx,
179 - bench_fnv,
180 - bench_sea,
181 - bench_sip
182 -);
183 diff --git a/tests/map_tests.rs b/tests/map_tests.rs
184 deleted file mode 100644
185 index be617a2..0000000
186 --- a/tests/map_tests.rs
187 +++ /dev/null
188 @@ -1,203 +0,0 @@
189 -use std::hash::{BuildHasher, Hash, Hasher};
190 -
191 -use criterion::*;
192 -use fxhash::FxHasher;
193 -
194 -use ahash::{AHasher, CallHasher, RandomState};
195 -
196 -fn gen_word_pairs() -> Vec<String> {
197 - let words: Vec<_> = r#"
198 -a, ability, able, about, above, accept, according, account, across, act, action,
199 -activity, actually, add, address, administration, admit, adult, affect, after,
200 -again, against, age, agency, agent, ago, agree, agreement, ahead, air, all,
201 -allow, almost, alone, along, already, also, although, always, American, among,
202 -amount, analysis, and, animal, another, answer, any, anyone, anything, appear,
203 -apply, approach, area, argue, arm, around, arrive, art, article, artist, as,
204 -ask, assume, at, attack, attention, attorney, audience, author, authority,
205 -available, avoid, away, baby, back, bad, bag, ball, bank, bar, base, be, beat,
206 -beautiful, because, become, bed, before, begin, behavior, behind, believe,
207 -benefit, best, better, between, beyond, big, bill, billion, bit, black, blood,
208 -blue, board, body, book, born, both, box, boy, break, bring, brother, budget,
209 -build, building, business, but, buy, by, call, camera, campaign, can, cancer,
210 -candidate, capital, car, card, care, career, carry, case, catch, cause, cell,
211 -center, central, century, certain, certainly, chair, challenge, chance, change,
212 -character, charge, check, child, choice, choose, church, citizen, city, civil,
213 -claim, class, clear, clearly, close, coach, cold, collection, college, color,
214 -come, commercial, common, community, company, compare, computer, concern,
215 -condition, conference, Congress, consider, consumer, contain, continue, control,
216 -cost, could, country, couple, course, court, cover, create, crime, cultural,
217 -culture, cup, current, customer, cut, dark, data, daughter, day, dead, deal,
218 -death, debate, decade, decide, decision, deep, defense, degree, Democrat,
219 -democratic, describe, design, despite, detail, determine, develop, development,
220 -die, difference, different, difficult, dinner, direction, director, discover,
221 -discuss, discussion, disease, do, doctor, dog, door, down, draw, dream, drive,
222 -drop, drug, during, each, early, east, easy, eat, economic, economy, edge,
223 -education, effect, effort, eight, either, election, else, employee, end, energy,
224 -enjoy, enough, enter, entire, environment, environmental, especially, establish,
225 -even, evening, event, ever, every, everybody, everyone, everything, evidence,
226 -exactly, example, executive, exist, expect, experience, expert, explain, eye,
227 -face, fact, factor, fail, fall, family, far, fast, father, fear, federal, feel,
228 -feeling, few, field, fight, figure, fill, film, final, finally, financial, find,
229 -fine, finger, finish, fire, firm, first, fish, five, floor, fly, focus, follow,
230 -food, foot, for, force, foreign, forget, form, former, forward, four, free,
231 -friend, from, front, full, fund, future, game, garden, gas, general, generation,
232 -get, girl, give, glass, go, goal, good, government, great, green, ground, group,
233 -grow, growth, guess, gun, guy, hair, half, hand, hang, happen, happy, hard,
234 -have, he, head, health, hear, heart, heat, heavy, help, her, here, herself,
235 -high, him, himself, his, history, hit, hold, home, hope, hospital, hot, hotel,
236 -hour, house, how, however, huge, human, hundred, husband, I, idea, identify, if,
237 -image, imagine, impact, important, improve, in, include, including, increase,
238 -indeed, indicate, individual, industry, information, inside, instead,
239 -institution, interest, interesting, international, interview, into, investment,
240 -involve, issue, it, item, its, itself, job, join, just, keep, key, kid, kill,
241 -kind, kitchen, know, knowledge, land, language, large, last, late, later, laugh,
242 -law, lawyer, lay, lead, leader, learn, least, leave, left, leg, legal, less,
243 -let, letter, level, lie, life, light, like, likely, line, list, listen, little,
244 -live, local, long, look, lose, loss, lot, love, low, machine, magazine, main,
245 -maintain, major, majority, make, man, manage, management, manager, many, market,
246 -marriage, material, matter, may, maybe, me, mean, measure, media, medical, meet,
247 -meeting, member, memory, mention, message, method, middle, might, military,
248 -million, mind, minute, miss, mission, model, modern, moment, money, month, more,
249 -morning, most, mother, mouth, move, movement, movie, Mr, Mrs, much, music, must,
250 -my, myself, name, nation, national, natural, nature, near, nearly, necessary,
251 -need, network, never, new, news, newspaper, next, nice, night, no, none, nor,
252 -north, not, note, nothing, notice, now, n't, number, occur, of, off, offer,
253 -office, officer, official, often, oh, oil, ok, old, on, once, one, only, onto,
254 -open, operation, opportunity, option, or, order, organization, other, others,
255 -our, out, outside, over, own, owner, page, pain, painting, paper, parent, part,
256 -participant, particular, particularly, partner, party, pass, past, patient,
257 -pattern, pay, peace, people, per, perform, performance, perhaps, period, person,
258 -personal, phone, physical, pick, picture, piece, place, plan, plant, play,
259 -player, PM, point, police, policy, political, politics, poor, popular,
260 -population, position, positive, possible, power, practice, prepare, present,
261 -president, pressure, pretty, prevent, price, private, probably, problem,
262 -process, produce, product, production, professional, professor, program,
263 -project, property, protect, prove, provide, public, pull, purpose, push, put,
264 -quality, question, quickly, quite, race, radio, raise, range, rate, rather,
265 -reach, read, ready, real, reality, realize, really, reason, receive, recent,
266 -recently, recognize, record, red, reduce, reflect, region, relate, relationship,
267 -religious, remain, remember, remove, report, represent, Republican, require,
268 -research, resource, respond, response, responsibility, rest, result, return,
269 -reveal, rich, right, rise, risk, road, rock, role, room, rule, run, safe, same,
270 -save, say, scene, school, science, scientist, score, sea, season, seat, second,
271 -section, security, see, seek, seem, sell, send, senior, sense, series, serious,
272 -serve, service, set, seven, several, sex, sexual, shake, share, she, shoot,
273 -short, shot, should, shoulder, show, side, sign, significant, similar, simple,
274 -simply, since, sing, single, sister, sit, site, situation, six, size, skill,
275 -skin, small, smile, so, social, society, soldier, some, somebody, someone,
276 -something, sometimes, son, song, soon, sort, sound, source, south, southern,
277 -space, speak, special, specific, speech, spend, sport, spring, staff, stage,
278 -stand, standard, star, start, state, statement, station, stay, step, still,
279 -stock, stop, store, story, strategy, street, strong, structure, student, study,
280 -stuff, style, subject, success, successful, such, suddenly, suffer, suggest,
281 -summer, support, sure, surface, system, table, take, talk, task, tax, teach,
282 -teacher, team, technology, television, tell, ten, tend, term, test, than, thank,
283 -that, the, their, them, themselves, then, theory, there, these, they, thing,
284 -think, third, this, those, though, thought, thousand, threat, three, through,
285 -throughout, throw, thus, time, to, today, together, tonight, too, top, total,
286 -tough, toward, town, trade, traditional, training, travel, treat, treatment,
287 -tree, trial, trip, trouble, true, truth, try, turn, TV, two, type, under,
288 -understand, unit, until, up, upon, us, use, usually, value, various, very,
289 -victim, view, violence, visit, voice, vote, wait, walk, wall, want, war, watch,
290 -water, way, we, weapon, wear, week, weight, well, west, western, what, whatever,
291 -when, where, whether, which, while, white, who, whole, whom, whose, why, wide,
292 -wife, will, win, wind, window, wish, with, within, without, woman, wonder, word,
293 -work, worker, world, worry, would, write, writer, wrong, yard, yeah, year, yes,
294 -yet, you, young, your, yourself"#
295 - .split(',')
296 - .map(|word| word.trim())
297 - .collect();
298 -
299 - let mut word_pairs: Vec<_> = Vec::new();
300 - for word in &words {
301 - for other_word in &words {
302 - word_pairs.push(word.to_string() + " " + other_word);
303 - }
304 - }
305 - assert_eq!(1_000_000, word_pairs.len());
306 - word_pairs
307 -}
308 -
309 -#[allow(unused)] // False positive
310 -fn test_hash_common_words<B: BuildHasher>(build_hasher: &B) {
311 - let word_pairs: Vec<_> = gen_word_pairs();
312 - check_for_collisions(build_hasher, &word_pairs, 32);
313 -}
314 -
315 -#[allow(unused)] // False positive
316 -fn check_for_collisions<H: Hash, B: BuildHasher>(build_hasher: &B, items: &[H], bucket_count: usize) {
317 - let mut buckets = vec![0; bucket_count];
318 - for item in items {
319 - let value = hash(item, build_hasher) as usize;
320 - buckets[value % bucket_count] += 1;
321 - }
322 - let mean = items.len() / bucket_count;
323 - let max = *buckets.iter().max().unwrap();
324 - let min = *buckets.iter().min().unwrap();
325 - assert!(
326 - (min as f64) > (mean as f64) * 0.95,
327 - "min: {}, max:{}, {:?}",
328 - min,
329 - max,
330 - buckets
331 - );
332 - assert!(
333 - (max as f64) < (mean as f64) * 1.05,
334 - "min: {}, max:{}, {:?}",
335 - min,
336 - max,
337 - buckets
338 - );
339 -}
340 -
341 -#[allow(unused)] // False positive
342 -fn hash<H: Hash, B: BuildHasher>(b: &H, build_hasher: &B) -> u64 {
343 - H::get_hash(b, build_hasher)
344 -}
345 -
346 -#[test]
347 -fn test_bucket_distribution() {
348 - let build_hasher = RandomState::with_seeds(1, 2, 3, 4);
349 - test_hash_common_words(&build_hasher);
350 - let sequence: Vec<_> = (0..320000).collect();
351 - check_for_collisions(&build_hasher, &sequence, 32);
352 - let sequence: Vec<_> = (0..2560000).collect();
353 - check_for_collisions(&build_hasher, &sequence, 256);
354 - let sequence: Vec<_> = (0..320000).map(|i| i * 1024).collect();
355 - check_for_collisions(&build_hasher, &sequence, 32);
356 - let sequence: Vec<_> = (0..2560000_u64).map(|i| i * 1024).collect();
357 - check_for_collisions(&build_hasher, &sequence, 256);
358 -}
359 -
360 -fn ahash_vec<H: Hash>(b: &Vec<H>) -> u64 {
361 - let mut total: u64 = 0;
362 - for item in b {
363 - let mut hasher = AHasher::new_with_keys(1234, 5678);
364 - item.hash(&mut hasher);
365 - total = total.wrapping_add(hasher.finish());
366 - }
367 - total
368 -}
369 -
370 -fn fxhash_vec<H: Hash>(b: &Vec<H>) -> u64 {
371 - let mut total: u64 = 0;
372 - for item in b {
373 - let mut hasher = FxHasher::default();
374 - item.hash(&mut hasher);
375 - total = total.wrapping_add(hasher.finish());
376 - }
377 - total
378 -}
379 -
380 -fn bench_ahash_words(c: &mut Criterion) {
381 - let words = gen_word_pairs();
382 - c.bench_function("aes_words", |b| b.iter(|| black_box(ahash_vec(&words))));
383 -}
384 -
385 -fn bench_fx_words(c: &mut Criterion) {
386 - let words = gen_word_pairs();
387 - c.bench_function("fx_words", |b| b.iter(|| black_box(fxhash_vec(&words))));
388 -}
389 -
390 -criterion_main!(benches);
391 -criterion_group!(benches, bench_ahash_words, bench_fx_words,);
0 remove-criterion.patch
1 update-rand-to-0.8.patch
2 relax-deps-version.patch
0 diff --git a/Cargo.toml b/Cargo.toml
1 index 9d5c5b7..ce96a26 100644
2 --- a/Cargo.toml
3 +++ b/Cargo.toml
4 @@ -67,7 +67,7 @@ version = "0.4.2"
5 version = "0.1.10"
6
7 [dev-dependencies.rand]
8 -version = "0.7.3"
9 +version = "0.8"
10
11 [dev-dependencies.seahash]
12 version = "4.0"