diff options
| author | natterman12 <92529018+natterman12@users.noreply.github.com> | 2026-11-23 21:24:10 -0500 |
|---|---|---|
| committer | natterman12 <92529018+natterman12@users.noreply.github.com> | 2026-11-23 21:24:10 -0500 |
| commit | 9541c00907bdcf6cfadc16a0b6a2e0da2bf51383 (patch) | |
| tree | 924288d304327684282a31af84803edd132f1e9a /runtime/src/xma2_decoder.cpp | |
| parent | 9ec34cdff41b19d7671bc260e5f40dc69790d905 (diff) | |
manifest: hash through one reused buffer, halving peak chunk memory per worker (OLD-4922)
_hash_file() read each 8 MiB chunk with f.read(), which allocates the next
bytes object while the last one is still referenced: two chunks per worker
at the peak. With --jobs N that is 16 MiB times N for hashing alone.
It now fills one memoryview-backed bytearray with readinto(), as
manifest_verifier.sha256_file() already does. Digests, sizes and the
change-during-read checks are unchanged.
Measured on a 320 MiB file: tracemalloc peak 16.0 -> 8.0 MiB.
Tests: a multi-chunk file must hash right with a peak under 1.5 chunks, a
short readinto() must not skip or repeat bytes, and the edit-during-read
case hooks readinto, the call the tool now makes.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/xma2_decoder.cpp')
0 files changed, 0 insertions, 0 deletions