@@ -25,6 +25,12 @@ import (
2525 "github.com/go-openapi/swag"
2626)
2727
28+ const (
29+ allocLargeMap = 150
30+ allocMediumMap = 64
31+ allocSmallMap = 10
32+ )
33+
2834type referenceAnalysis struct {
2935 schemas map [string ]spec.Ref
3036 responses map [string ]spec.Ref
@@ -169,30 +175,30 @@ type Spec struct {
169175}
170176
171177func (s * Spec ) reset () {
172- s .consumes = make (map [string ]struct {}, 150 )
173- s .produces = make (map [string ]struct {}, 150 )
174- s .authSchemes = make (map [string ]struct {}, 150 )
175- s .operations = make (map [string ]map [string ]* spec.Operation , 150 )
176- s .allSchemas = make (map [string ]SchemaRef , 150 )
177- s .allOfs = make (map [string ]SchemaRef , 150 )
178- s .references .schemas = make (map [string ]spec.Ref , 150 )
179- s .references .pathItems = make (map [string ]spec.Ref , 150 )
180- s .references .responses = make (map [string ]spec.Ref , 150 )
181- s .references .parameters = make (map [string ]spec.Ref , 150 )
182- s .references .items = make (map [string ]spec.Ref , 150 )
183- s .references .headerItems = make (map [string ]spec.Ref , 150 )
184- s .references .parameterItems = make (map [string ]spec.Ref , 150 )
185- s .references .allRefs = make (map [string ]spec.Ref , 150 )
186- s .patterns .parameters = make (map [string ]string , 150 )
187- s .patterns .headers = make (map [string ]string , 150 )
188- s .patterns .items = make (map [string ]string , 150 )
189- s .patterns .schemas = make (map [string ]string , 150 )
190- s .patterns .allPatterns = make (map [string ]string , 150 )
191- s .enums .parameters = make (map [string ][]interface {}, 150 )
192- s .enums .headers = make (map [string ][]interface {}, 150 )
193- s .enums .items = make (map [string ][]interface {}, 150 )
194- s .enums .schemas = make (map [string ][]interface {}, 150 )
195- s .enums .allEnums = make (map [string ][]interface {}, 150 )
178+ s .consumes = make (map [string ]struct {}, allocLargeMap )
179+ s .produces = make (map [string ]struct {}, allocLargeMap )
180+ s .authSchemes = make (map [string ]struct {}, allocLargeMap )
181+ s .operations = make (map [string ]map [string ]* spec.Operation , allocLargeMap )
182+ s .allSchemas = make (map [string ]SchemaRef , allocLargeMap )
183+ s .allOfs = make (map [string ]SchemaRef , allocLargeMap )
184+ s .references .schemas = make (map [string ]spec.Ref , allocLargeMap )
185+ s .references .pathItems = make (map [string ]spec.Ref , allocLargeMap )
186+ s .references .responses = make (map [string ]spec.Ref , allocLargeMap )
187+ s .references .parameters = make (map [string ]spec.Ref , allocLargeMap )
188+ s .references .items = make (map [string ]spec.Ref , allocLargeMap )
189+ s .references .headerItems = make (map [string ]spec.Ref , allocLargeMap )
190+ s .references .parameterItems = make (map [string ]spec.Ref , allocLargeMap )
191+ s .references .allRefs = make (map [string ]spec.Ref , allocLargeMap )
192+ s .patterns .parameters = make (map [string ]string , allocLargeMap )
193+ s .patterns .headers = make (map [string ]string , allocLargeMap )
194+ s .patterns .items = make (map [string ]string , allocLargeMap )
195+ s .patterns .schemas = make (map [string ]string , allocLargeMap )
196+ s .patterns .allPatterns = make (map [string ]string , allocLargeMap )
197+ s .enums .parameters = make (map [string ][]interface {}, allocLargeMap )
198+ s .enums .headers = make (map [string ][]interface {}, allocLargeMap )
199+ s .enums .items = make (map [string ][]interface {}, allocLargeMap )
200+ s .enums .schemas = make (map [string ][]interface {}, allocLargeMap )
201+ s .enums .allEnums = make (map [string ][]interface {}, allocLargeMap )
196202}
197203
198204func (s * Spec ) reload () {
0 commit comments