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 May 5, 2022
1 parent ee72e57 commit 92ef2af
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 < 100000; 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 92ef2af

Please sign in to comment.