-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase print/visit performance (#4312)
This replaces our expensive method that changes the underlying V8 shape multiple times with a loop that preserves the identity as much as possible. ``` ⏱ Print kitchen sink document 1 tests completed. 2 tests completed. HEAD x 9,290 ops/sec ±0.21% x 1.51 KB/op (24 runs sampled) BASE x 2,645 ops/sec ±0.18% x 2.18 KB/op (11 runs sampled) ``` --------- Co-authored-by: Benjie <[email protected]>
- Loading branch information
1 parent
90ebe5a
commit 31bf28f
Showing
4 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery { | ||
whoever123is: node(id: [123, 456]) { | ||
id | ||
... on User @onInlineFragment { | ||
field2 { | ||
id | ||
alias: field1(first: 10, after: $foo) @include(if: $foo) { | ||
id | ||
...frag @onFragmentSpread | ||
} | ||
} | ||
} | ||
... @skip(unless: $foo) { | ||
id | ||
} | ||
... { | ||
id | ||
} | ||
} | ||
} | ||
|
||
mutation likeStory @onMutation { | ||
like(story: 123) @onField { | ||
story { | ||
id @onField | ||
} | ||
} | ||
} | ||
|
||
subscription StoryLikeSubscription( | ||
$input: StoryLikeSubscribeInput @onVariableDefinition | ||
) @onSubscription { | ||
storyLikeSubscribe(input: $input) { | ||
story { | ||
likers { | ||
count | ||
} | ||
likeSentence { | ||
text | ||
} | ||
} | ||
} | ||
} | ||
|
||
fragment frag on Friend @onFragmentDefinition { | ||
foo( | ||
size: $size | ||
bar: $b | ||
obj: { | ||
key: "value" | ||
block: """ | ||
block string uses \""" | ||
""" | ||
} | ||
) | ||
} | ||
{ | ||
unnamed(truthy: true, falsy: false, nullish: null) | ||
query | ||
} | ||
query { | ||
__typename | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
const { parse } = require('graphql/language/parser.js'); | ||
const { print } = require('graphql/language/printer.js'); | ||
|
||
const { bigDocumentSDL } = require('./fixtures.js'); | ||
|
||
const document = parse(bigDocumentSDL); | ||
|
||
module.exports = { | ||
name: 'Print kitchen sink document', | ||
count: 1000, | ||
measure() { | ||
print(document); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters