From 61f457c4d9176eabd9106a7a0e59e66694cc830c Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 21 Oct 2020 14:29:49 +0100 Subject: [PATCH] Minor optimisation --- roomserver/internal/input/input_latest_events.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go index b0bb0a1c6..38e2b610d 100644 --- a/roomserver/internal/input/input_latest_events.go +++ b/roomserver/internal/input/input_latest_events.go @@ -255,10 +255,10 @@ func (u *latestEventsUpdater) calculateLatest( // forward extremities reference. existingIDs := make(map[string]*types.StateAtEventAndReference) existingPrevs := make(map[string]struct{}) - existingNIDs := []types.EventNID{} + existingNIDs := make([]types.EventNID, len(oldLatest)) for i, old := range oldLatest { existingIDs[old.EventID] = &oldLatest[i] - existingNIDs = append(existingNIDs, old.EventNID) + existingNIDs[i] = old.EventNID } // Look up the old extremity events. This allows us to find their