diff --git a/benchmark/list-asyncIterable-benchmark.js b/benchmark/list-asyncIterable-benchmark.js new file mode 100644 index 0000000000..3aee2674d2 --- /dev/null +++ b/benchmark/list-asyncIterable-benchmark.js @@ -0,0 +1,24 @@ +import { execute } from 'graphql/execution/execute.js'; +import { parse } from 'graphql/language/parser.js'; +import { buildSchema } from 'graphql/utilities/buildASTSchema.js'; + +const schema = buildSchema('type Query { listField: [String] }'); +const document = parse('{ listField }'); + +async function* listField() { + for (let index = 0; index < 100000; index++) { + yield index; + } +} + +export const benchmark = { + name: 'Execute Async Iterable List Field', + count: 10, + async measure() { + await execute({ + schema, + document, + rootValue: { listField }, + }); + }, +};