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 Apr 4, 2022
1 parent 369c28b commit a49dec8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions benchmark/list-asyncIterable-benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

const { parse } = require('graphql/language/parser.js');
const { execute } = require('graphql/execution/execute.js');
const { buildSchema } = require('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;
}
}

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

0 comments on commit a49dec8

Please sign in to comment.