event: initialize maps with known size (#27233)
event: initialize maps with known size
This commit is contained in:
parent
c62da24dce
commit
0fb1be0930
@ -61,7 +61,7 @@ func (mux *TypeMux) Subscribe(types ...interface{}) *TypeMuxSubscription {
|
|||||||
close(sub.postC)
|
close(sub.postC)
|
||||||
} else {
|
} else {
|
||||||
if mux.subm == nil {
|
if mux.subm == nil {
|
||||||
mux.subm = make(map[reflect.Type][]*TypeMuxSubscription)
|
mux.subm = make(map[reflect.Type][]*TypeMuxSubscription, len(types))
|
||||||
}
|
}
|
||||||
for _, t := range types {
|
for _, t := range types {
|
||||||
rtyp := reflect.TypeOf(t)
|
rtyp := reflect.TypeOf(t)
|
||||||
|
Loading…
Reference in New Issue
Block a user