load_m1_window double-materializes (AoS buffer -> SoA columns) with an un-presized growing Vec #78
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
load_m1_windowdouble-materializes (AoS buffer → SoA columns) with an un-presized growingVecFound during a code-level performance audit (load/ingest edge, not the per-cycle hot path).
Problem
crates/aura-ingest/src/lib.rs:118-131:Chunks → AoS buffer (full copy, growing by reallocation) → SoA columns (second full
copy). That is ~2× peak memory + realloc churn at load time. One-time per window
(or per sweep point if reloaded), so not on the per-cycle hot path — but it is a
clean, risk-free memory win. The lazy
M1FieldSource(lib.rs:164-244) alreadyhandles the streaming case well (O(one chunk) resident).
Fix
Transpose directly from the chunk iterator into the SoA columns, dropping the
intermediate
Vec<M1Parsed>entirely (one fewer full materialization, halved peak).Where the iterator can report a size hint/count, pre-size the columns.
This is behaviour-preserving: the resulting
M1Columnsis byte-identical to thecurrent path (same pushes, same order);
transpose_m1stays as-is for the existingunit tests.
Acceptance
load_m1_windowno longer allocates the intermediate AoSVec.M1Columnsidentical to today on the existing fixtures.cargo test --workspacegreen.