From c9009ba4557ebb48ed528cdcc1b3f01b4cdd3060 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:43:49 +0000 Subject: [PATCH 1/2] perf: pre-allocate slice capacity in evalRetrieve Pre-allocate the slice capacity in `evalRetrieve` using `make([]result.Value, 0, len(got))` to avoid multiple reallocations as the slice grows. This is a standard optimization in Go when the maximum size of the resulting slice is known beforehand. Co-authored-by: suyashkumar <6299853+suyashkumar@users.noreply.github.com> --- interpreter/expressions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interpreter/expressions.go b/interpreter/expressions.go index 97835e6..52c273b 100644 --- a/interpreter/expressions.go +++ b/interpreter/expressions.go @@ -191,7 +191,7 @@ func (i *interpreter) evalRetrieve(expr *model.Retrieve) (result.Value, error) { return result.Value{}, fmt.Errorf("internal error - retrieve result type should be a list of named types, got %v", listResultType) } - l := []result.Value{} + l := make([]result.Value, 0, len(got)) for _, c := range got { r, err := unwrapContained(c) if err != nil { From bf161573046add7cf479439c8b63e590cc697a59 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 28 Feb 2026 00:53:31 +0000 Subject: [PATCH 2/2] perf: pre-allocate slice capacity in evalRetrieve Pre-allocate the slice capacity in `evalRetrieve` using `make([]result.Value, 0, len(got))` to avoid multiple reallocations as the slice grows. This is a standard optimization in Go when the maximum size of the resulting slice is known beforehand. Co-authored-by: suyashkumar <6299853+suyashkumar@users.noreply.github.com>