core/filtermaps: preallocate slices in writeFinishedMaps

This commit is contained in:
Sushil-19 2026-03-03 13:33:36 +05:30
parent d318e8eba9
commit 54e9cc8957

View file

@ -426,10 +426,10 @@ func (r *mapRenderer) writeFinishedMaps(pauseCb func() bool) error {
} }
// add or update filter rows // add or update filter rows
for rowIndex := uint32(0); rowIndex < r.f.mapHeight; rowIndex++ { for rowIndex := uint32(0); rowIndex < r.f.mapHeight; rowIndex++ {
var ( capacity := len(r.finishedMaps)
mapIndices []uint32
rows []FilterRow mapIndices := make([]uint32, 0, capacity)
) rows := make([]FilterRow, 0, capacity)
for mapIndex := range r.finished.Iter() { for mapIndex := range r.finished.Iter() {
row := r.finishedMaps[mapIndex].filterMap[rowIndex] row := r.finishedMaps[mapIndex].filterMap[rowIndex]
if fm, _ := r.f.filterMapCache.Get(mapIndex); fm != nil && row.Equal(fm[rowIndex]) { if fm, _ := r.f.filterMapCache.Get(mapIndex); fm != nil && row.Equal(fm[rowIndex]) {