mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-21 20:36:05 +03:00
PHPBench
This commit is contained in:
parent
4d4282b60f
commit
68bfde953d
@ -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
|
||||
```
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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",
|
||||
|
@ -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' => [
|
||||
|
Loading…
Reference in New Issue
Block a user