Skip to content

Commit 58c72ab

Browse files
committed
add benchmark tests for async iterable list fields
1 parent 9e1c9c2 commit 58c72ab

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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('type Query { listField: [String] }');
6+
const document = parse('{ listField }');
7+
8+
async function* listField() {
9+
for (let index = 0; index < 1000; index++) {
10+
yield index;
11+
}
12+
}
13+
14+
export const benchmark = {
15+
name: 'Execute Async Iterable List Field',
16+
count: 10,
17+
async measure() {
18+
await execute({
19+
schema,
20+
document,
21+
rootValue: { listField },
22+
});
23+
},
24+
};

0 commit comments

Comments
 (0)