event: initialize maps with known size (#27233)

event: initialize maps with known size
pull/27241/head
ucwong 2 years ago committed by GitHub
parent c62da24dce
commit 0fb1be0930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      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)

Loading…
Cancel
Save