mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-01 21:59:44 +00:00
perf(filer): pre-size chunk stream reader buffer to view size
The chunk size is known up front, so grow the buffer once instead of letting bytes.Buffer double as the streamed pieces arrive (which transiently overshoots to ~2x per reader).
This commit is contained in:
@@ -484,6 +484,8 @@ func (c *ChunkStreamReader) fetchChunkToBuffer(chunkView *ChunkView) error {
|
||||
return err
|
||||
}
|
||||
var buffer bytes.Buffer
|
||||
// pre-size to the known chunk size; avoids bytes.Buffer's doubling regrowth
|
||||
buffer.Grow(int(chunkView.ViewSize))
|
||||
var shouldRetry bool
|
||||
jwt := JwtForVolumeServer(chunkView.FileId)
|
||||
for _, urlString := range urlStrings {
|
||||
|
||||
Reference in New Issue
Block a user