From 1f695da111e1ae9086c7e610f8fd039b6dba3748 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 18 May 2022 23:20:29 +0300 Subject: [PATCH] benchmark: test perfomance cost of recreating schema Nessary as part of a current and possible future disscussion on perfomance penalties of schema transformation. --- benchmark/GraphQLSchema-benchmark.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 benchmark/GraphQLSchema-benchmark.js diff --git a/benchmark/GraphQLSchema-benchmark.js b/benchmark/GraphQLSchema-benchmark.js new file mode 100644 index 0000000000..f9ee9eee54 --- /dev/null +++ b/benchmark/GraphQLSchema-benchmark.js @@ -0,0 +1,15 @@ +import { GraphQLSchema } from 'graphql/type/schema.js'; +import { buildClientSchema } from 'graphql/utilities/buildClientSchema.js'; + +import { bigSchemaIntrospectionResult } from './fixtures.js'; + +const bigSchema = buildClientSchema(bigSchemaIntrospectionResult.data); + +export const benchmark = { + name: 'Recreate a GraphQLSchema', + count: 40, + measure() { + // eslint-disable-next-line no-new + new GraphQLSchema(bigSchema.toConfig()); + }, +};