Skip to content

Commit

Permalink
Merge pull request #314 from ChargePoint/preAllocMaps
Browse files Browse the repository at this point in the history
right-sized destinations
  • Loading branch information
chris-ramon authored Apr 10, 2018
2 parents 7435a02 + de1350d commit c35670f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func executeFieldsSerially(p executeFieldsParams) *Result {
p.Fields = map[string][]*ast.Field{}
}

finalResults := map[string]interface{}{}
finalResults := make(map[string]interface{}, len(p.Fields))
for responseName, fieldASTs := range p.Fields {
resolved, state := resolveField(p.ExecutionContext, p.ParentType, p.Source, fieldASTs)
if state.hasNoFieldDefs {
Expand All @@ -279,7 +279,7 @@ func executeFields(p executeFieldsParams) *Result {
p.Fields = map[string][]*ast.Field{}
}

finalResults := map[string]interface{}{}
finalResults := make(map[string]interface{}, len(p.Fields))
for responseName, fieldASTs := range p.Fields {
resolved, state := resolveField(p.ExecutionContext, p.ParentType, p.Source, fieldASTs)
if state.hasNoFieldDefs {
Expand Down Expand Up @@ -791,7 +791,7 @@ func completeListValue(eCtx *executionContext, returnType *List, fieldASTs []*as
}

itemType := returnType.OfType
completedResults := []interface{}{}
completedResults := make([]interface{}, 0, resultVal.Len())
for i := 0; i < resultVal.Len(); i++ {
val := resultVal.Index(i).Interface()
completedItem := completeValueCatchingError(eCtx, itemType, fieldASTs, info, val)
Expand Down

0 comments on commit c35670f

Please sign in to comment.