From 8c1126822a7e0c88d6e90a0eede1f44fa4fe02bb Mon Sep 17 00:00:00 2001 From: anaz Date: Tue, 31 Dec 2024 17:00:25 +0530 Subject: [PATCH] perf: preallocate slice with known length to optimize Mem Allocs --- internal/compiler/query_catalog.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/compiler/query_catalog.go b/internal/compiler/query_catalog.go index 80b59d876c..2d3a124a5d 100644 --- a/internal/compiler/query_catalog.go +++ b/internal/compiler/query_catalog.go @@ -86,7 +86,7 @@ func (qc QueryCatalog) GetTable(rel *ast.TableName) (*Table, error) { if err != nil { return nil, err } - var cols []*Column + cols := make([]*Column, 0, len(src.Columns)) for _, c := range src.Columns { cols = append(cols, ConvertColumn(rel, c)) }