Skip to main content

operand_chunk_bytes

Function operand_chunk_bytes 

Source
pub(crate) fn operand_chunk_bytes(series: &Series) -> usize
Expand description

The bytes one chunk a binary operand retains holds on its own.

It is chunk_bytes_beside_samples with the samples a chunk’s rows occupy in place of the allocations they are slices of, and with the struct the chunk’s Series carries: a series delivered in a thousand chunks holds a thousand slices of one buffer, so counting that buffer once per chunk would make the operand’s figure grow with the number of chunks rather than with the data in them. The slices of one series add up to the allocation they share, which is the figure a deduplication across the chunks would arrive at.

The struct is part of this figure because an operand keeps one entry per retained chunk and counts no container of its own, so the entry and the chunk in it are one figure here. A retainer that does count its container takes chunk_bytes_beside_samples instead.

The histogram tables a chunk’s segments reference are not part of the figure: a table is one allocation however many chunks index into it, so it is not a per-chunk cost at all. Dropping it here is therefore only half the story – it must not become a figure the operand never charges. unbilled_tables is the other half, and the operand bills each table once through it.