-
-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
34 changed files
with
422 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace GraphQL\Benchmarks; | ||
|
||
use GraphQL\Utils\BuildSchema; | ||
|
||
use function range; | ||
|
||
/** | ||
* @BeforeMethods({"makeSchemaString"}) | ||
* @OutputTimeUnit("milliseconds", precision=3) | ||
* @Warmup(2) | ||
* @Revs(10) | ||
* @Iterations(2) | ||
*/ | ||
class BuildSchemaBench | ||
{ | ||
private string $schema = /** @lang GraphQL */ <<<GRAPHQL | ||
type Query { | ||
foo: Foo | ||
} | ||
interface F { | ||
foo: ID | ||
} | ||
type Foo implements F { | ||
foo: ID | ||
} | ||
type Bar { | ||
bar: ID | ||
} | ||
GRAPHQL; | ||
|
||
public function makeSchemaString(): void | ||
{ | ||
foreach (range(1, 100) as $i) { | ||
$this->schema .= /** @lang GraphQL */ <<<GRAPHQL | ||
union U{$i} = Foo | Bar | ||
directive @d{$i} on | ||
| QUERY | ||
| MUTATION | ||
| SUBSCRIPTION | ||
| FIELD | ||
| FRAGMENT_DEFINITION | ||
| FRAGMENT_SPREAD | ||
| INLINE_FRAGMENT | ||
| VARIABLE_DEFINITION | ||
| SCHEMA | ||
| SCALAR | ||
| OBJECT | ||
| FIELD_DEFINITION | ||
| ARGUMENT_DEFINITION | ||
| INTERFACE | ||
| UNION | ||
| ENUM | ||
| ENUM_VALUE | ||
| INPUT_OBJECT | ||
| INPUT_FIELD_DEFINITION | ||
GRAPHQL; | ||
} | ||
} | ||
|
||
public function benchBuildSchema(): void | ||
{ | ||
BuildSchema::build($this->schema); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.