bind: Preallocate capacity for fields slice

This commit is contained in:
qcrao 2024-04-20 20:34:15 +08:00
parent 2e06fbd409
commit 14bb0f6dec

View file

@ -395,7 +395,7 @@ func bindStructTypeGo(kind abi.Type, structs map[string]*tmplStruct) string {
} }
var ( var (
names = make(map[string]bool) names = make(map[string]bool)
fields []*tmplField fields = make([]*tmplField, 0, len(kind.TupleElems))
) )
for i, elem := range kind.TupleElems { for i, elem := range kind.TupleElems {
name := capitalise(kind.TupleRawNames[i]) name := capitalise(kind.TupleRawNames[i])