mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 06:16: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
|
```sh
|
||||||
./vendor/bin/phpcs
|
./vendor/bin/phpcs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Running benchmarks
|
||||||
|
|
||||||
|
Benchmarks are run via phpbench:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./vendor/bin/phpbench run
|
||||||
|
```
|
||||||
|
@ -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()
|
||||||
|
@ -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
|
||||||
);
|
);
|
||||||
|
@ -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",
|
||||||
|
@ -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' => [
|
||||||
|
Loading…
Reference in New Issue
Block a user