From fd95589c9699a9309939834881d6b273d08a1bd1 Mon Sep 17 00:00:00 2001 From: Yoann La Cancellera Date: Fri, 24 Nov 2023 10:25:22 +0100 Subject: [PATCH] preallocate lastcontexts map --- src/go/pt-galera-log-explainer/display/timelinecli.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/go/pt-galera-log-explainer/display/timelinecli.go b/src/go/pt-galera-log-explainer/display/timelinecli.go index e5dbe52c..23efe958 100644 --- a/src/go/pt-galera-log-explainer/display/timelinecli.go +++ b/src/go/pt-galera-log-explainer/display/timelinecli.go @@ -22,9 +22,9 @@ func TimelineCLI(timeline types.Timeline, verbosity types.Verbosity) { // to hold the current context for each node // "keys" is needed, because iterating over a map must give a different order each time // a slice keeps its order - keys, currentContext := initKeysContext(timeline) // currentcontext to follow when important thing changed - latestContext := timeline.GetLatestContextsByNodes() // so that we have fully updated context when we print - lastContext := map[string]types.LogCtx{} // just to follow when important thing changed + keys, currentContext := initKeysContext(timeline) // currentcontext to follow when important thing changed + latestContext := timeline.GetLatestContextsByNodes() // so that we have fully updated context when we print + lastContext := make(map[string]types.LogCtx, len(timeline)) // just to follow when important thing changed w := tabwriter.NewWriter(os.Stdout, 8, 8, 3, ' ', tabwriter.DiscardEmptyColumns) defer w.Flush()