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

Function compression_ratio

nodedb-codec/src/spherical.rs:311–319  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

309
310 #[test]
311 fn compression_ratio() {
312 let data = make_normalized_vectors(1000, 128);
313 let encoded = encode(&data, 128, 1000).unwrap();
314 let raw_size = data.len() * 4;
315 let ratio = raw_size as f64 / encoded.len() as f64;
316 // Spherical transform regularizes data for better lz4 compression.
317 // Should not expand data significantly.
318 assert!(ratio > 0.9, "should not expand >10%, got {ratio:.2}x");
319 }
320
321 #[test]
322 fn normalization_check() {

Callers

nothing calls this directly

Calls 3

make_normalized_vectorsFunction · 0.85
encodeFunction · 0.70
lenMethod · 0.45

Tested by

no test coverage detected