Skip to content

Commit 2a1fead

Browse files
refactor(perf): Presizes GraphQLFieldDefinitionMap
This improves benchmarked `graphql` time by 5%
1 parent 49a42ac commit 2a1fead

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Sources/GraphQL/Type/Definition.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ extension GraphQLObjectType: Hashable {
351351
}
352352

353353
func defineFieldMap(name: String, fields: GraphQLFieldMap) throws -> GraphQLFieldDefinitionMap {
354-
var fieldMap = GraphQLFieldDefinitionMap()
354+
var fieldMap = GraphQLFieldDefinitionMap(minimumCapacity: fields.count)
355355

356356
for (name, config) in fields {
357357
try assertValid(name: name)

0 commit comments

Comments
 (0)