From cdb430b2a51d971c403ec22a9e50b91e43b0bc2e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 10 Aug 2024 05:35:29 +0900 Subject: [PATCH] vector: reduce allocations --- vector/path.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vector/path.go b/vector/path.go index e60415c87..85700b622 100644 --- a/vector/path.go +++ b/vector/path.go @@ -557,12 +557,13 @@ func (p *Path) AppendVerticesAndIndicesForStroke(vertices []ebiten.Vertex, indic return vertices, indices } + var rects [][4]point for _, subpath := range p.ensureSubpaths() { if subpath.pointCount() < 2 { continue } - var rects [][4]point + rects = rects[:0] for i := 0; i < subpath.pointCount()-1; i++ { pt := subpath.points[i]