Skip to content

Stream accumulators and avoid alignment copies in combining_sum. - #336

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_1030829508
Nov 27, 2026
Merged

copybara-service[bot] merged 1 commit into
mainfrom
test_1030829508

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Stream accumulators and avoid alignment copies in combining_sum.

CombiningSum.merge_accumulators materialized the entire incoming iterable into a list, holding every partial accumulator in memory at once. Also, calling xr.align(..., join='outer') defaults to copy=True and deep-copied both arrays on every step even when coordinates already matched.

Pass a lazy generator from CombiningSum.merge_accumulators into combining_sum, and set copy=False so already-aligned inputs share memory without copying and peak memory stays bounded.

@copybara-service
copybara-service Bot force-pushed the test_1030829508 branch 3 times, most recently from ea3aeb9 to 7538675 Compare November 27, 2026 16:16
CombiningSum.merge_accumulators materialized the entire incoming iterable into a list, holding every partial accumulator in memory at once. Also, calling `xr.align(..., join='outer')` defaults to copy=True and deep-copied both arrays on every step even when coordinates already matched.

Pass a lazy generator from CombiningSum.merge_accumulators into combining_sum, and set copy=False so already-aligned inputs share memory without copying and peak memory stays bounded.

PiperOrigin-RevId: 1031286657
@copybara-service
copybara-service Bot merged commit ff69cd4 into main Nov 27, 2026
3 checks passed
@copybara-service
copybara-service Bot deleted the test_1030829508 branch November 27, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant