File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ import { execute } from 'graphql/execution/execute.js' ;
2+ import { parse } from 'graphql/language/parser.js' ;
3+ import { buildSchema } from 'graphql/utilities/buildASTSchema.js' ;
4+
5+ const schema = buildSchema ( `
6+ type Query {
7+ listField: [Object]
8+ }
9+
10+ type Object {
11+ field: String
12+ }
13+ ` ) ;
14+ const document = parse ( '{ listField { field } }' ) ;
15+
16+ function listField ( ) {
17+ const results = [ ] ;
18+ for ( let index = 0 ; index < 1 ; index ++ ) {
19+ results . push ( Promise . resolve ( { field : Promise . resolve ( index ) } ) ) ;
20+ }
21+ return results ;
22+ }
23+
24+ export const benchmark = {
25+ name : 'Execute Asynchronous List Field with Nested Asynchronous Fields' ,
26+ count : 10 ,
27+ async measure ( ) {
28+ await execute ( {
29+ schema,
30+ document,
31+ rootValue : { listField } ,
32+ } ) ;
33+ } ,
34+ } ;
You can’t perform that action at this time.
0 commit comments