Skip to main content

DEFAULT_TRIM_ELEMENTS_THRESHOLD

Constant DEFAULT_TRIM_ELEMENTS_THRESHOLD 

Source
pub const DEFAULT_TRIM_ELEMENTS_THRESHOLD: f32 = 0.05;
Expand description

Waste threshold to decide whether to trim a zero-copy-to-list ListViewArray.

A zero-copy-to-list array has no overlaps and no interior gaps, so its only unreferenced bytes are leading and trailing elements. Trimming those is much cheaper than a full rebuild (a lazy elements slice plus an O(num_lists) offset adjustment, with no element data copy), so we use a more aggressive threshold than DEFAULT_REBUILD_DENSITY_THRESHOLD.

When the unreferenced (leading + trailing) fraction of elements exceeds this threshold, we trim.