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

Function write_amp_tracking

nodedb/src/engine/kv/engine.rs:664–687  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

662
663 #[test]
664 fn write_amp_tracking() {
665 let mut e = make_engine();
666 let n = now();
667
668 e.register_index(1, "c", "a", 0, false, n);
669 e.register_index(1, "c", "b", 1, false, n);
670
671 for i in 0..10u32 {
672 let k = format!("k{i}");
673 e.put(
674 1,
675 "c",
676 k.as_bytes(),
677 &mp_obj(&[("a", "x"), ("b", "y")]),
678 0,
679 n,
680 Surrogate::ZERO,
681 );
682 }
683
684 // 10 PUTs, 2 indexes each = write amp ratio of 2.0.
685 let ratio = e.write_amp_ratio(1, "c");
686 assert!((ratio - 2.0).abs() < f64::EPSILON);
687 }
688
689 #[test]
690 fn raw_put_timing() {

Callers

nothing calls this directly

Calls 7

nowFunction · 0.85
mp_objFunction · 0.85
register_indexMethod · 0.80
make_engineFunction · 0.70
putMethod · 0.45
as_bytesMethod · 0.45
write_amp_ratioMethod · 0.45

Tested by

no test coverage detected