Skip to content

Commit 09d56d6

Browse files
committed
add benchmark tests for async iterable list fields
1 parent 8cf1890 commit 09d56d6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
const { parse } = require('graphql/language/parser.js');
4+
const { execute } = require('graphql/execution/execute.js');
5+
const { buildSchema } = require('graphql/utilities/buildASTSchema.js');
6+
7+
const schema = buildSchema('type Query { listField: [String] }');
8+
const document = parse('{ listField }');
9+
10+
async function* listField() {
11+
for (let index = 0; index < 100000; index++) {
12+
yield index;
13+
}
14+
}
15+
16+
module.exports = {
17+
name: 'Execute Async Iterable List Field',
18+
count: 10,
19+
async measure() {
20+
await execute({
21+
schema,
22+
document,
23+
rootValue: { listField },
24+
});
25+
},
26+
};

0 commit comments

Comments
 (0)