{
  "version": 3,
  "sources": ["../../src/benchmarks/index.ts"],
  "sourcesContent": ["import fs from \"fs\";\nimport path from \"path\";\nimport NiceBenchmark from \"./nice-benchmark\";\nimport schema from \"./swapi-schema\";\nimport resolvers from \"./swapi-schema/resolvers\";\nimport models from \"./swapi-schema/models\";\nimport {\n  execute as graphqlExecute,\n  parse,\n  // experimentalExecuteIncrementally as graphqlExecute,\n} from \"graphql\";\nimport { compileQuery, isCompiledQuery } from \"graphql-jit\";\nimport { executeWithoutSchema as supermassiveExecute } from \"../executeWithoutSchema\";\nimport { UserResolvers, SchemaFragment } from \"../types\";\nimport { extractMinimalViableSchemaForRequestDocument } from \"../utilities/extractMinimalViableSchemaForRequestDocument\";\n\nconst query = fs.readFileSync(\n  path.join(__dirname, \"./fixtures/query1.graphql\"),\n  {\n    encoding: \"utf-8\",\n  },\n);\n\nconst parsedQuery = parse(query);\nconst compiledQuery = compileQuery(schema, parsedQuery);\n\nconst { definitions } = extractMinimalViableSchemaForRequestDocument(\n  schema,\n  parsedQuery,\n);\n\nconst schemaFragment: SchemaFragment = {\n  schemaId: \"benchmark\",\n  definitions,\n  resolvers: resolvers as UserResolvers,\n};\n\nconst queryRunningSuite = new NiceBenchmark(\"Query Running\");\nqueryRunningSuite.add(\"graphql-js - string queries\", async () => {\n  const result = await graphqlExecute({\n    schema,\n    document: parse(query),\n    contextValue: { models },\n  });\n  if (result.errors || !result.data) {\n    throw new Error(\"Stuff ain't executing\");\n  }\n});\nqueryRunningSuite.add(\"graphql-js - parsed queries\", async () => {\n  const result = await graphqlExecute({\n    schema,\n    document: parsedQuery,\n    contextValue: { models },\n  });\n  if (result.errors || !result.data) {\n    throw new Error(\"Stuff ain't executing\");\n  }\n});\nqueryRunningSuite.add(\"graphql-jit - uncompiled\", async () => {\n  const freshCompiledQuery = compileQuery(schema, parsedQuery);\n  if (isCompiledQuery(freshCompiledQuery)) {\n    const result = await freshCompiledQuery.query({}, { models }, {});\n    if (result.errors || !result.data) {\n      throw new Error(\"Stuff ain't executing\");\n    }\n  } else {\n    throw new Error(\"Wrong query\");\n  }\n});\nqueryRunningSuite.add(\"graphql-jit - precompiled\", async () => {\n  if (isCompiledQuery(compiledQuery)) {\n    const result = await compiledQuery.query({}, { models }, {});\n    if (result.errors || !result.data) {\n      throw new Error(\"Stuff ain't executing\");\n    }\n  } else {\n    throw new Error(\"Wrong query\");\n  }\n});\nqueryRunningSuite.add(\"supermassive - runtime schemaless\", async () => {\n  const result = await supermassiveExecute({\n    schemaFragment,\n    document: parsedQuery,\n    contextValue: { models },\n  });\n  if (\"data\" in result && (result.errors || !result.data)) {\n    throw new Error(\"Stuff ain't executing\");\n  }\n});\n\nqueryRunningSuite.add(\n  \"supermassive - before operation execute sync hook - runtime schemaless\",\n  async () => {\n    const result = await supermassiveExecute({\n      schemaFragment,\n      document: parsedQuery,\n      fieldExecutionHooks: {\n        beforeOperationExecute: ({ context }) => {\n          (context as any).test = 0;\n        },\n      },\n      contextValue: { models },\n    });\n    if (\"data\" in result && (result.errors || !result.data)) {\n      throw new Error(\"Stuff ain't executing\");\n    }\n  },\n);\n\nqueryRunningSuite.add(\n  \"supermassive - before operation execute async hook - runtime schemaless\",\n  async () => {\n    const result = await supermassiveExecute({\n      schemaFragment,\n      document: parsedQuery,\n      fieldExecutionHooks: {\n        beforeOperationExecute: async ({ context }) => {\n          (context as any).test = 0;\n        },\n      },\n      contextValue: { models },\n    });\n    if (\"data\" in result && (result.errors || !result.data)) {\n      throw new Error(\"Stuff ain't executing\");\n    }\n  },\n);\n\nqueryRunningSuite.add(\n  \"supermassive - before field resolve sync hook - runtime schemaless\",\n  async () => {\n    const result = await supermassiveExecute({\n      schemaFragment,\n      document: parsedQuery,\n      fieldExecutionHooks: {\n        beforeFieldResolve: ({ context }) => {\n          (context as any).test = 0;\n        },\n      },\n      contextValue: { models },\n    });\n    if (\"data\" in result && (result.errors || !result.data)) {\n      throw new Error(\"Stuff ain't executing\");\n    }\n  },\n);\n\nqueryRunningSuite.add(\n  \"supermassive - before field resolve async hook - runtime schemaless\",\n  async () => {\n    const result = await supermassiveExecute({\n      schemaFragment,\n      document: parsedQuery,\n      fieldExecutionHooks: {\n        beforeFieldResolve: async ({ context }) => {\n          (context as any).test = 0;\n        },\n      },\n      contextValue: { models },\n    });\n    if (\"data\" in result && (result.errors || !result.data)) {\n      throw new Error(\"Stuff ain't executing\");\n    }\n  },\n);\n\nconst queryParsingSuite = new NiceBenchmark(\"Query parsing\");\nqueryParsingSuite.add(\"graphql-js\", async () => {\n  parse(query);\n});\n\nconst queryCompilingSuite = new NiceBenchmark(\"Query compiling\");\nqueryCompilingSuite.add(\"graphql-jit\", async () => {\n  await compileQuery(schema, parsedQuery);\n});\n\nconst queryAnnotationSuite = new NiceBenchmark(\"Query annotation\");\nqueryAnnotationSuite.add(\"supermassive\", () => {\n  extractMinimalViableSchemaForRequestDocument(schema, parsedQuery);\n});\n\nasync function main() {\n  await queryCompilingSuite.run();\n  await queryParsingSuite.run();\n  await queryAnnotationSuite.run();\n  await queryRunningSuite.run();\n}\n\nmain();\n"],
  "mappings": ";AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,mBAAmB;AAC1B,OAAO,YAAY;AACnB,OAAO,eAAe;AACtB,OAAO,YAAY;AACnB;AAAA,EACE,WAAW;AAAA,EACX;AAAA,OAEK;AACP,SAAS,cAAc,uBAAuB;AAC9C,SAAS,wBAAwB,2BAA2B;AAE5D,SAAS,oDAAoD;AAE7D,IAAM,QAAQ,GAAG;AAAA,EACf,KAAK,KAAK,WAAW,2BAA2B;AAAA,EAChD;AAAA,IACE,UAAU;AAAA,EACZ;AACF;AAEA,IAAM,cAAc,MAAM,KAAK;AAC/B,IAAM,gBAAgB,aAAa,QAAQ,WAAW;AAEtD,IAAM,EAAE,YAAY,IAAI;AAAA,EACtB;AAAA,EACA;AACF;AAEA,IAAM,iBAAiC;AAAA,EACrC,UAAU;AAAA,EACV;AAAA,EACA;AACF;AAEA,IAAM,oBAAoB,I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