pub fn hash_many_multithreaded<P: Prepared + ?Sized>(
mode: Mode<'_>,
batch: &P,
out: &mut [[u8; 32]],
)Expand description
hash_many, eligible to use other CPU cores above the split
threshold: always the same digests as single-threaded hash_many.
use blake3_servil::Mode;
let mut leaves = blake3_servil::throughput::Batch::new(256, 4096);
(0..4096).for_each(|i| leaves.set(i, &[7u8; 256]));
let mut hashes = vec![[0u8; 32]; 4096];
blake3_servil::throughput::hash_many_multithreaded(Mode::Plain, &leaves, &mut hashes);
assert!(hashes.iter().all(|h| h == blake3_servil::convenience::hash(&[7u8; 256]).as_bytes()));Speed: below 512 KiB of compression-block bytes (count × max(64, round_up(message_len, 64)) for both Batch and Packed<N>, so
4,096 × 36 B stays serial while 8,192 × 16 B, 32 B, 36 B, or 64 B all
qualify; an implementation heuristic, not a frozen contract), or with
fewer than two messages, it runs on the calling thread at
hash_many’s speed. Larger batches are eligible to use available
worker threads (on an Apple M4 Max, 64-byte messages from about 10
down to 3 ns each). It shares the cores with other callers as
hash_multithreaded does.