Skip to content

Instantly share code, notes, and snippets.

View Daniel-Liu-c0deb0t's full-sized avatar
🦀
Rust + SIMD

Daniel Liu Daniel-Liu-c0deb0t

🦀
Rust + SIMD
View GitHub Profile
@Daniel-Liu-c0deb0t
Daniel-Liu-c0deb0t / minimizers.rs
Last active December 24, 2023 02:37
Robust winnowing with ntHash
/// 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
};
@Daniel-Liu-c0deb0t
Daniel-Liu-c0deb0t / bench.rs
Last active May 11, 2020 21:35
Rust Target Features Performance Pitfall
// 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