From a8762b78d327e97c3c818842e5a948ba118fefd8 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 4 Nov 2026 21:07:42 +0100 Subject: benchmark what sync bytes are --- src/document/sync.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/document/sync.rs') diff --git a/src/document/sync.rs b/src/document/sync.rs index f45a316..29efb5d 100644 --- a/src/document/sync.rs +++ b/src/document/sync.rs @@ -27,6 +27,18 @@ impl Received { pub(crate) fn carries_changes(&self) -> bool { !self.0.changes.is_empty() } + + /// The bytes of the changes it carries, and of its bloom filters (`have`). + pub(crate) fn sizes(&self) -> (usize, usize) { + let changes = self.0.changes.iter().map(<[u8]>::len).sum(); + let blooms = self + .0 + .have + .iter() + .map(|have| have.bloom.to_bytes().len()) + .sum(); + (changes, blooms) + } } /// `payload` decoded. Before taking the document's lock: decoding a large message takes -- cgit v1.3.1