This commit is contained in:
Simon Podlipsky 2018-09-26 11:18:02 +02:00
parent 4d4282b60f
commit 68bfde953d
No known key found for this signature in database
GPG Key ID: 725C2BD962B42663
5 changed files with 16 additions and 7 deletions

View File

@ -33,3 +33,11 @@ Coding standard of this project is based on [Doctrine CS](https://github.com/doc
```sh ```sh
./vendor/bin/phpcs ./vendor/bin/phpcs
``` ```
## Running benchmarks
Benchmarks are run via phpbench:
```sh
./vendor/bin/phpbench run
```

View File

@ -57,13 +57,13 @@ class HugeSchemaBench
public function benchSmallQuery() public function benchSmallQuery()
{ {
$result = GraphQL::execute($this->schema, $this->smallQuery); $result = GraphQL::executeQuery($this->schema, $this->smallQuery);
} }
public function benchSmallQueryLazy() public function benchSmallQueryLazy()
{ {
$schema = $this->createLazySchema(); $schema = $this->createLazySchema();
$result = GraphQL::execute($schema, $this->smallQuery); $result = GraphQL::executeQuery($schema, $this->smallQuery);
} }
private function createLazySchema() private function createLazySchema()

View File

@ -35,7 +35,7 @@ class StarWarsBench
} }
'; ';
GraphQL::execute( GraphQL::executeQuery(
StarWarsSchema::build(), StarWarsSchema::build(),
$q $q
); );
@ -57,7 +57,7 @@ class StarWarsBench
} }
} }
'; ';
GraphQL::execute( GraphQL::executeQuery(
StarWarsSchema::build(), StarWarsSchema::build(),
$q $q
); );
@ -81,7 +81,7 @@ class StarWarsBench
} }
'; ';
GraphQL::execute( GraphQL::executeQuery(
StarWarsSchema::build(), StarWarsSchema::build(),
$q $q
); );
@ -89,7 +89,7 @@ class StarWarsBench
public function benchStarWarsIntrospectionQuery() public function benchStarWarsIntrospectionQuery()
{ {
GraphQL::execute( GraphQL::executeQuery(
StarWarsSchema::build(), StarWarsSchema::build(),
$this->introQuery $this->introQuery
); );

View File

@ -15,6 +15,7 @@
}, },
"require-dev": { "require-dev": {
"doctrine/coding-standard": "^4.0", "doctrine/coding-standard": "^4.0",
"phpbench/phpbench": "^0.14.0",
"phpstan/phpstan": "^0.10.3", "phpstan/phpstan": "^0.10.3",
"phpstan/phpstan-phpunit": "^0.10.0", "phpstan/phpstan-phpunit": "^0.10.0",
"phpunit/phpunit": "^7.2", "phpunit/phpunit": "^7.2",

View File

@ -18,7 +18,7 @@ try {
$query = $input['query']; $query = $input['query'];
$variableValues = isset($input['variables']) ? $input['variables'] : null; $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) { } catch (\Exception $e) {
$result = [ $result = [
'error' => [ 'error' => [