diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 95804ce..6996683 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,3 +33,11 @@ Coding standard of this project is based on [Doctrine CS](https://github.com/doc ```sh ./vendor/bin/phpcs ``` + +## Running benchmarks + +Benchmarks are run via phpbench: + +```sh +./vendor/bin/phpbench run +``` diff --git a/benchmarks/HugeSchemaBench.php b/benchmarks/HugeSchemaBench.php index 31073e2..19d6837 100644 --- a/benchmarks/HugeSchemaBench.php +++ b/benchmarks/HugeSchemaBench.php @@ -57,13 +57,13 @@ class HugeSchemaBench public function benchSmallQuery() { - $result = GraphQL::execute($this->schema, $this->smallQuery); + $result = GraphQL::executeQuery($this->schema, $this->smallQuery); } public function benchSmallQueryLazy() { $schema = $this->createLazySchema(); - $result = GraphQL::execute($schema, $this->smallQuery); + $result = GraphQL::executeQuery($schema, $this->smallQuery); } private function createLazySchema() diff --git a/benchmarks/StarWarsBench.php b/benchmarks/StarWarsBench.php index 1690808..faa0a97 100644 --- a/benchmarks/StarWarsBench.php +++ b/benchmarks/StarWarsBench.php @@ -35,7 +35,7 @@ class StarWarsBench } '; - GraphQL::execute( + GraphQL::executeQuery( StarWarsSchema::build(), $q ); @@ -57,7 +57,7 @@ class StarWarsBench } } '; - GraphQL::execute( + GraphQL::executeQuery( StarWarsSchema::build(), $q ); @@ -81,7 +81,7 @@ class StarWarsBench } '; - GraphQL::execute( + GraphQL::executeQuery( StarWarsSchema::build(), $q ); @@ -89,7 +89,7 @@ class StarWarsBench public function benchStarWarsIntrospectionQuery() { - GraphQL::execute( + GraphQL::executeQuery( StarWarsSchema::build(), $this->introQuery ); diff --git a/composer.json b/composer.json index f33c497..c536480 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ }, "require-dev": { "doctrine/coding-standard": "^4.0", + "phpbench/phpbench": "^0.14.0", "phpstan/phpstan": "^0.10.3", "phpstan/phpstan-phpunit": "^0.10.0", "phpunit/phpunit": "^7.2", diff --git a/examples/02-shorthand/graphql.php b/examples/02-shorthand/graphql.php index 7e07ffa..e958955 100644 --- a/examples/02-shorthand/graphql.php +++ b/examples/02-shorthand/graphql.php @@ -18,7 +18,7 @@ try { $query = $input['query']; $variableValues = isset($input['variables']) ? $input['variables'] : null; - $result = GraphQL::execute($schema, $query, $rootValue, null, $variableValues); + $result = GraphQL::executeQuery($schema, $query, $rootValue, null, $variableValues); } catch (\Exception $e) { $result = [ 'error' => [