rust/src/libcoretest
bors ff6c6ce917 Auto merge of #27280 - bluss:siphash-perf, r=alexcrichton
Improve siphash performance for longer data

Use `ptr::copy_nonoverlapping` (aka memcpy) to load an u64 from the
byte stream. This is correct for any alignment, and the compiler will
use the appropriate instruction to load the data.

Also contains small tweaks that should benefit hashing short data too,
both the commit that removes a variable and the autovectorization of
the hash state initialization (in SipHash::reset).

Benchmarks show that hashing longer data benefits for the improved word loading.

Before (using benchmarks from the first commit in the PR):

The before benchmark is a bit noisy.

```
test hash::sip::bench_bytes_4                              ... bench:          41 ns/iter (+/- 0) = 97 MB/s
test hash::sip::bench_bytes_7                              ... bench:          49 ns/iter (+/- 2) = 142 MB/s
test hash::sip::bench_bytes_8                              ... bench:          42 ns/iter (+/- 4) = 190 MB/s
test hash::sip::bench_bytes_a_16                           ... bench:          57 ns/iter (+/- 14) = 280 MB/s
test hash::sip::bench_bytes_b_32                           ... bench:          85 ns/iter (+/- 74) = 376 MB/s
test hash::sip::bench_bytes_c_128                          ... bench:         278 ns/iter (+/- 33) = 460 MB/s
test hash::sip::bench_long_str                             ... bench:         825 ns/iter (+/- 103)
test hash::sip::bench_str_of_8_bytes                       ... bench:         151 ns/iter (+/- 66)
test hash::sip::bench_str_over_8_bytes                     ... bench:          59 ns/iter (+/- 3)
test hash::sip::bench_str_under_8_bytes                    ... bench:          47 ns/iter (+/- 56)
test hash::sip::bench_u32                                  ... bench:          39 ns/iter (+/- 93) = 205 MB/s
test hash::sip::bench_u32_keyed                            ... bench:          40 ns/iter (+/- 88) = 200 MB/s
test hash::sip::bench_u64                                  ... bench:          54 ns/iter (+/- 96) = 148 MB/s
```

After:

```
test hash::sip::bench_bytes_4                              ... bench:          41 ns/iter (+/- 3) = 97 MB/s
test hash::sip::bench_bytes_7                              ... bench:          48 ns/iter (+/- 0) = 145 MB/s
test hash::sip::bench_bytes_8                              ... bench:          35 ns/iter (+/- 1) = 228 MB/s
test hash::sip::bench_bytes_a_16                           ... bench:          45 ns/iter (+/- 1) = 355 MB/s
test hash::sip::bench_bytes_b_32                           ... bench:          60 ns/iter (+/- 0) = 533 MB/s
test hash::sip::bench_bytes_c_128                          ... bench:         161 ns/iter (+/- 5) = 795 MB/s
test hash::sip::bench_long_str                             ... bench:         514 ns/iter (+/- 5)
test hash::sip::bench_str_of_8_bytes                       ... bench:          44 ns/iter (+/- 0)
test hash::sip::bench_str_over_8_bytes                     ... bench:          51 ns/iter (+/- 0)
test hash::sip::bench_str_under_8_bytes                    ... bench:          52 ns/iter (+/- 6)
test hash::sip::bench_u32                                  ... bench:          40 ns/iter (+/- 2) = 200 MB/s
test hash::sip::bench_u32_keyed                            ... bench:          39 ns/iter (+/- 1) = 205 MB/s
test hash::sip::bench_u64                                  ... bench:          36 ns/iter (+/- 1) = 222 MB/s
```
2015-07-28 05:38:53 +00:00
..
fmt Fix negate_unsigned feature gate check 2015-07-14 21:48:43 +03:00
hash siphash: Add more benchmarks 2015-07-25 12:26:17 +02:00
num optimize from_str_radix 2015-07-19 09:54:44 -03:00
any.rs Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
atomic.rs Use const fn to abstract away the contents of UnsafeCell & friends. 2015-05-27 11:19:03 +03:00
cell.rs Add map and filter_map associated functions to std::cell::Ref and RefMut 2015-05-29 08:39:07 +02:00
char.rs Remove char::to_titlecase. Fix #26555 2015-06-24 22:16:25 -07:00
clone.rs
cmp.rs std: Bring back f32::from_str_radix as an unstable API 2015-04-21 15:23:54 -07:00
intrinsics.rs Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
iter.rs Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
lib.rs Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00
mem.rs std: Remove #[old_orphan_check] from PartialEq 2015-03-31 13:39:14 -07:00
nonzero.rs Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
ops.rs Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
option.rs Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00
ptr.rs Use vec![elt; n] where possible 2015-07-09 11:05:32 +02:00
result.rs libcore/Result - RFC#1119 Add an 'expect' method to Result 2015-06-15 12:00:16 +08:00
slice.rs std: Remove index notation on slice iterators 2015-05-01 10:40:46 -07:00
str.rs Moved coretest::str tests into collectiontest::str 2015-04-05 18:52:58 +02:00
tuple.rs