event: initialize maps with known size (#27233)

event: initialize maps with known size
This commit is contained in:
ucwong
2023-05-09 15:29:32 -04:00
committed by GitHub
parent c62da24dce
commit 0fb1be0930
+1 -1
View File
@@ -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)