Performance: add preallocation for some slice/map (#57860)

This change preallocates slices and maps where the size of the data is known before the object is created.

Co-authored-by: Joe Blubaugh <joe.blubaugh@grafana.com>
This commit is contained in:
Denis Limarev
2022-11-22 18:24:36 +06:00
committed by GitHub
parent 460be70261
commit 4d8287b319
8 changed files with 15 additions and 13 deletions

View File

@ -59,7 +59,7 @@ func (value *FrontendSentryExceptionValue) FmtStacktrace(store *SourceMapStore)
}
func (exception *FrontendSentryException) FmtStacktraces(store *SourceMapStore) string {
var stacktraces []string
stacktraces := make([]string, 0, len(exception.Values))
for _, value := range exception.Values {
stacktraces = append(stacktraces, value.FmtStacktrace(store))
}