Unverified Commit 0fb1be09 authored by ucwong's avatar ucwong Committed by GitHub

event: initialize maps with known size (#27233)

event: initialize maps with known size
parent c62da24d
...@@ -61,7 +61,7 @@ func (mux *TypeMux) Subscribe(types ...interface{}) *TypeMuxSubscription { ...@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment