diff options
| author | tv <tv@krebsco.de> | 2026-11-04 21:07:42 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-04 21:07:42 +0100 |
| commit | a8762b78d327e97c3c818842e5a948ba118fefd8 (patch) | |
| tree | 60308cecf72a0fa247f807746588a23f136f89ab /src/document | |
| parent | 9f4820d5d121025e908da9ca98783f2827044768 (diff) | |
benchmark what sync bytes are
Diffstat (limited to 'src/document')
| -rw-r--r-- | src/document/sync.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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 |
