This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// ntHash constants. | |
static LUT: [u64; 128] = { | |
let mut l = [0u64; 128]; | |
l[b'A' as usize] = 0x3c8bfbb395c60474u64; | |
l[b'C' as usize] = 0x3193c18562a02b4cu64; | |
l[b'G' as usize] = 0x20323ed082572324u64; | |
l[b'T' as usize] = 0x295549f54be24456u64; | |
l | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Surprisingly, the benchmarks in this code do *not* take the same time to run, | |
// even if the x86-64 CPU supports AVX2 instructions. | |
// | |
// Here are the results on my machine with an Intel i7-7500U CPU at 2.7 GHz: | |
// | |
// 1. avx_raw: ~80 ns | |
// 2. avx_with_struct_fn: ~35 ns | |
// 3. avx_with_fn_mod: ~80 ns | |
// 4. avx_with_fn: ~80 ns | |
// 5. avx_with_fn_10: ~11 ns |