-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Benchmark introspecting a schema built from SDL in a supplied file. (#…
…1163) * Benchmark introspecting a schema built from SDL in a supplied file. Use it like so: ```shell yarn run benchmark ```` Additionally there is a profile command which runs the benchmark with `--prof`: ```shell yarn run profile ```` Note that on Ubuntu 16.04 this requires: ```shell sudo apt install linux-tools-common gawk linux-tools-generic linux-tools-4.10.0-35-generic sudo sh -c 'echo 1 >/proc/sys/kernel/perf_event_paranoid' ``` On my laptop it produces this: ``` $ yarn run benchmark > [email protected] benchmark /home/osboxes/graphql-js > babel-node ./resources/benchmark/run.js introspectionQuery x 24.59 ops/sec ±3.87% (45 runs sampled) ``` * Move into benchmark tests
- Loading branch information
Showing
6 changed files
with
48,158 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import { join } from 'path'; | ||
import { readFileSync } from 'fs'; | ||
import { parse } from '../../'; | ||
import { buildASTSchema } from '../buildASTSchema'; | ||
|
||
const schemaAST = parse( | ||
readFileSync(join(__dirname, 'github-schema.graphql'), 'utf8'), | ||
); | ||
|
||
export const name = 'Build Schema from AST'; | ||
export function measure() { | ||
buildASTSchema(schemaAST); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import { join } from 'path'; | ||
import { readFileSync } from 'fs'; | ||
import { buildClientSchema } from '../buildClientSchema'; | ||
|
||
const schemaJSON = JSON.parse( | ||
readFileSync(join(__dirname, 'github-schema.json'), 'utf8'), | ||
); | ||
|
||
export const name = 'Build Schema from Introspection'; | ||
export function measure() { | ||
buildClientSchema(schemaJSON.data); | ||
} |
Oops, something went wrong.