From 25f741fc44ae4a2fa57037a410f921bbe8fee7c4 Mon Sep 17 00:00:00 2001 From: qcrao Date: Wed, 11 Dec 2024 22:35:33 +0800 Subject: [PATCH] opt: pre-allocate chunk blocks slice in chunk proposer --- rollup/internal/controller/watcher/chunk_proposer.go | 1 + 1 file changed, 1 insertion(+) diff --git a/rollup/internal/controller/watcher/chunk_proposer.go b/rollup/internal/controller/watcher/chunk_proposer.go index 87056e646..72757513d 100644 --- a/rollup/internal/controller/watcher/chunk_proposer.go +++ b/rollup/internal/controller/watcher/chunk_proposer.go @@ -295,6 +295,7 @@ func (p *ChunkProposer) proposeChunk() error { } var chunk encoding.Chunk + chunk.Blocks = make([]*encoding.Block, 0, len(blocks)) for i, block := range blocks { chunk.Blocks = append(chunk.Blocks, block)