Preallocate append targets flagged by prealloc (refs #61)

collectBatchFlushData now sizes the file-chunk and chunk-file slices to
the number of pending files, a safe lower bound since every file
contributes at least one mapping of each kind. The chunker test sizes
its reconstruction buffer to the input length, which is exactly what it
ends up holding. Append semantics and results are unchanged.
This commit is contained in:
2026-08-09 01:48:44 +00:00
parent 7a37a66d88
commit cb25b01e70
2 changed files with 6 additions and 6 deletions

View File

@@ -53,7 +53,7 @@ func TestChunkerLargeFileMultipleChunks(t *testing.T) {
}
// Verify chunks reconstruct original data
var reconstructed []byte
reconstructed := make([]byte, 0, len(data))
for _, chunk := range chunks {
reconstructed = append(reconstructed, chunk.Data...)
}