Skip to main content

Module sparsity

Module sparsity 

Source
Expand description

Sparsity levels controlling per-array capacity slack.

A sparse array over-allocates its dense storage in fixed steps. A larger step wastes more memory but reallocates less often on insert. Sparsity does not change lookup speed or iteration order. It changes only the memory and insert-speed trade-off.

Structs§

High
Least memory slack. Grows by 2. Slower inserts.
Low
Most memory slack. Grows by 8. Faster inserts.
Medium
Balanced slack. Grows by 4. The default.

Traits§

Sparsity
A sparsity level. STEP is the amount a full sparse array grows by.