-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MVP of mocha-like benchmark tests #1167
Conversation
While it would make me sad-face to have this PR merged and not mine, more importantly I suggest that @leebyron 's steer that it should be a complex schema is more important. The GitHub schema I put in mine is large, so introspecting it is, in my view, more of a meaningful test than |
@mohawk2 Sorry, I didn't explained my intention for this PR. Last week I also tryed to refactor part of this library ( So this PR more about creating an engine for benchmark than adding particular benchmarks. As example I just added benchmarks for I deliberately didn't add tests for suite('Parse string to AST', graphql => {
const kitchenSink = readFileSync(join(__dirname, './kitchen-sink.graphql'), {
encoding: 'utf8',
});
measure('Kitchen Sink', () => graphql.parse(kitchenSink));
const introspectionQuery = getIntrospectionQuery();
measure('Introspection Query', () => graphql.parse(introspectionQuery));
}); If this PR is merged I will be able to add benchmark for |
That makes lots of sense! (At least to me) One observation I have: if we put benchmarks (which are very intensive and a bit time-consuming, by design) in the tests, then they'll get run all the time. Instead they ought to live outside of the You may or may not have seen that my benchmark thing now also has a |
@IvanGoncharov Further thought; I really like the idea of the modularised tests, though I'm still convinced they mustn't live within the normal tests' location. What I'm also very keen on is being able to have each test-module be run say just one or two times under the profiler, so there's not dozens of runs to drown us in data. If you can steer me on how to do this, or you want to take it on, I'm happy with either! |
9329a92
to
027e29b
Compare
027e29b
to
8e2c7f1
Compare
Sorry for not addressing this PR much sooner. I really like this but have some high level feedback.
|
@leebyron Thanks for the feedback. |
I have a version I built to look at eliminating distRequire - I started with your code. I just put it up at #1251 - I'd love your feedback and thoughts on it I realised that staying within |
@mohawk2 I really like your idea from #1163 and I think we need to cover more functions (
validate
,buildSchema
,parse
, etc.) with benchmarks like that.So I created a very small mocha-like wrapper around benchmark.js, plus I think
babel-node
isn't suitable for performance measurement so I benchmark pure JS. As a bonus, you can specify git revision (HEAD
by default) to benchmark your local copy against.Also, you can benchmark multiple Git revision against each other, e.g: