MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / compression_vs_raw

Function compression_vs_raw

nodedb-codec/src/delta.rs:392–401  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

390
391 #[test]
392 fn compression_vs_raw() {
393 let values: Vec<i64> = (0..100_000).map(|i| i * 1000).collect();
394 let encoded = encode(&values);
395 let raw_size = values.len() * 8;
396 let ratio = raw_size as f64 / encoded.len() as f64;
397 assert!(
398 ratio > 3.0,
399 "expected >3x compression for monotonic counter, got {ratio:.1}x"
400 );
401 }
402}

Callers

nothing calls this directly

Calls 3

collectMethod · 0.80
encodeFunction · 0.70
lenMethod · 0.45

Tested by

no test coverage detected