Skip to content

Commit aa8524f

Browse files
committed
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) ```
1 parent fd4a69c commit aa8524f

File tree

4 files changed

+48129
-1
lines changed

4 files changed

+48129
-1
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"watch": "babel-node ./resources/watch.js",
4040
"cover": "babel-node ./node_modules/.bin/isparta cover --root src --report html _mocha -- $npm_package_options_mocha",
4141
"cover:lcov": "babel-node ./node_modules/.bin/isparta cover --root src --report lcovonly _mocha -- $npm_package_options_mocha",
42+
"benchmark": "babel-node ./resources/benchmark/run.js",
43+
"profile": "perf record -e cycles:u -g -- babel-node --perf-basic-prof ./resources/benchmark/run.js && perf script |./node_modules/stackvis/cmd/stackvis perf >flamegraph.html && echo 'Now view flamegraph.html'",
4244
"preversion": ". ./resources/checkgit.sh && npm test",
4345
"prepublish": ". ./resources/prepublish.sh",
4446
"gitpublish": ". ./resources/gitpublish.sh"
@@ -56,6 +58,7 @@
5658
"babel-plugin-transform-flow-strip-types": "6.22.0",
5759
"babel-plugin-transform-object-rest-spread": "6.23.0",
5860
"babel-preset-env": "^1.5.2",
61+
"benchmark": "^2.1.4",
5962
"chai": "4.1.1",
6063
"chai-json-equal": "0.0.1",
6164
"chai-spies-next": "^0.8.0",
@@ -69,6 +72,7 @@
6972
"isparta": "4.0.0",
7073
"mocha": "3.5.0",
7174
"prettier": "^1.8.2",
72-
"sane": "2.0.0"
75+
"sane": "2.0.0",
76+
"stackvis": "^0.5.0"
7377
}
7478
}

0 commit comments

Comments
 (0)