Skip to content

Commit

Permalink
add benchmark tests for async iterable list fields
Browse files Browse the repository at this point in the history
  • Loading branch information
robrichard committed Jun 13, 2022
1 parent 9e1c9c2 commit 58c72ab
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions benchmark/list-asyncIterable-benchmark.js
Original file line number Diff line number Diff line change
@@ -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 < 1000; index++) {
yield index;
}
}

export const benchmark = {
name: 'Execute Async Iterable List Field',
count: 10,
async measure() {
await execute({
schema,
document,
rootValue: { listField },
});
},
};

0 comments on commit 58c72ab

Please sign in to comment.