From 0fb1be09303ef509d7824f0b9415a3645149437a Mon Sep 17 00:00:00 2001 From: ucwong Date: Tue, 9 May 2023 13:29:32 -0600 Subject: [PATCH] event: initialize maps with known size (#27233) event: initialize maps with known size --- event/event.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event/event.go b/event/event.go index ce1b03d523..25a2c2e457 100644 --- a/event/event.go +++ b/event/event.go @@ -61,7 +61,7 @@ func (mux *TypeMux) Subscribe(types ...interface{}) *TypeMuxSubscription { close(sub.postC) } else { if mux.subm == nil { - mux.subm = make(map[reflect.Type][]*TypeMuxSubscription) + mux.subm = make(map[reflect.Type][]*TypeMuxSubscription, len(types)) } for _, t := range types { rtyp := reflect.TypeOf(t)