Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb44edcf90 |
@@ -73,7 +73,8 @@ fn bench_compress(data: &[u8], codec: Codec) -> usize {
|
|||||||
fn bench_tdt_compress(c: &mut Criterion) {
|
fn bench_tdt_compress(c: &mut Criterion) {
|
||||||
let sizes = [4096usize, 65536];
|
let sizes = [4096usize, 65536];
|
||||||
|
|
||||||
let datasets: &[(&str, fn(usize) -> Vec<u8>, usize)] = &[
|
type DataGen = fn(usize) -> Vec<u8>;
|
||||||
|
let datasets: &[(&str, DataGen, usize)] = &[
|
||||||
("f32_smooth", make_f32_smooth, 4),
|
("f32_smooth", make_f32_smooth, 4),
|
||||||
("f32_random", make_f32_random, 4),
|
("f32_random", make_f32_random, 4),
|
||||||
("int32_random", make_int32_random, 4),
|
("int32_random", make_int32_random, 4),
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ mod tests {
|
|||||||
let all_entries: Vec<(u64, [u8; 32])> = (0..total as u64)
|
let all_entries: Vec<(u64, [u8; 32])> = (0..total as u64)
|
||||||
.map(|r| (r, rev_hash(r)))
|
.map(|r| (r, rev_hash(r)))
|
||||||
.collect();
|
.collect();
|
||||||
let keep_count = ((total as f64 * keep_frac) as usize).max(0);
|
let keep_count = (total as f64 * keep_frac) as usize;
|
||||||
let remote_entries = &all_entries[..keep_count];
|
let remote_entries = &all_entries[..keep_count];
|
||||||
|
|
||||||
let local = RevisionMerkleTree::build(&all_entries);
|
let local = RevisionMerkleTree::build(&all_entries);
|
||||||
|
|||||||
@@ -58,8 +58,10 @@ fn cold_data(n: usize) -> Vec<u8> {
|
|||||||
// Benchmark
|
// Benchmark
|
||||||
// ─────────────────────────────────────────────────────────────────────────────
|
// ─────────────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
type DataGen = fn(usize) -> Vec<u8>;
|
||||||
|
|
||||||
fn bench_cdc(c: &mut Criterion) {
|
fn bench_cdc(c: &mut Criterion) {
|
||||||
let datasets: &[(&str, fn(usize) -> Vec<u8>)] = &[
|
let datasets: &[(&str, DataGen)] = &[
|
||||||
("random", random_data),
|
("random", random_data),
|
||||||
("float", float_data),
|
("float", float_data),
|
||||||
("cold_only", cold_data),
|
("cold_only", cold_data),
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ pub fn chunk_scalar(data: &[u8], min: usize, avg: usize, max: usize) -> Vec<Chun
|
|||||||
/// Scalar processing for a single 16-byte (or shorter) slice, folding the
|
/// Scalar processing for a single 16-byte (or shorter) slice, folding the
|
||||||
/// updated hash back out. Used by both SIMD paths when a hot byte is detected.
|
/// updated hash back out. Used by both SIMD paths when a hot byte is detected.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
// Hot SIMD inner-loop helper: each arg is a distinct cursor/limit; bundling
|
||||||
|
// into a struct would add per-call overhead in the chunker fast path.
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn scalar_window(
|
fn scalar_window(
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
window: &[u8],
|
window: &[u8],
|
||||||
@@ -542,7 +545,7 @@ mod tests {
|
|||||||
let original = chunk_data_simd(&data);
|
let original = chunk_data_simd(&data);
|
||||||
// Flip a hot byte in the middle to force a different boundary
|
// Flip a hot byte in the middle to force a different boundary
|
||||||
let mid = 150_000;
|
let mid = 150_000;
|
||||||
data[mid] = data[mid] & 0x3F; // ensure it's a hot byte (< 64)
|
data[mid] &= 0x3F; // ensure it's a hot byte (< 64)
|
||||||
data[mid] ^= 0x11;
|
data[mid] ^= 0x11;
|
||||||
let mutated = chunk_data_simd(&data);
|
let mutated = chunk_data_simd(&data);
|
||||||
assert_ne!(original, mutated, "mutation should change chunk boundaries");
|
assert_ne!(original, mutated, "mutation should change chunk boundaries");
|
||||||
|
|||||||
Reference in New Issue
Block a user