MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / histogram_parallel

Function histogram_parallel

src/histogram.rs:17–26  ·  view source on GitHub ↗
(bytes: &[u8])

Source from the content-addressed store, hash-verified

15}
16
17fn histogram_parallel(bytes: &[u8]) -> [usize; 256] {
18 // Summing multiple 32 bit histograms is faster than a 64 bit histogram.
19 let mut total = [0; 256];
20 for bytes in bytes.chunks(u32::MAX as usize) {
21 for (i, &v) in histogram_parallel_u32(bytes).iter().enumerate() {
22 total[i] += v as usize;
23 }
24 }
25 total
26}
27
28// Based on https://github.com/facebook/zstd/blob/1518570c62b95136b6a69714012957cae5487a9a/lib/compress/hist.c#L66
29fn histogram_parallel_u32(bytes: &[u8]) -> [u32; 256] {

Callers 2

histogramFunction · 0.85
bench_histogram_parallelFunction · 0.85

Calls 1

histogram_parallel_u32Function · 0.85

Tested by

no test coverage detected