diff --git a/benchmarks/LexerBench.php b/benchmarks/LexerBench.php new file mode 100644 index 0000000..5f83cd8 --- /dev/null +++ b/benchmarks/LexerBench.php @@ -0,0 +1,35 @@ +introQuery = new Source(Introspection::getIntrospectionQuery()); + } + + /** + * @Warmup(2) + * @Revs(100) + * @Iterations(5) + */ + public function benchIntrospectionQuery() + { + $lexer = new Lexer($this->introQuery); + + do { + $token = $lexer->nextToken(); + } while ($token->kind !== Token::EOF); + } +} diff --git a/composer.json b/composer.json index dabf1cd..724a512 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,8 @@ }, "autoload-dev": { "psr-4": { - "GraphQL\\Tests\\": "tests/" + "GraphQL\\Tests\\": "tests/", + "GraphQL\\Benchmarks\\": "benchmarks/" } } } diff --git a/phpbench.json b/phpbench.json new file mode 100644 index 0000000..774a177 --- /dev/null +++ b/phpbench.json @@ -0,0 +1,6 @@ +{ + "bootstrap": "vendor/autoload.php", + "path": "benchmarks", + "retry_threshold": 5, + "time_unit": "milliseconds" +}