Total Complexity | 6 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
17 | class HugeSchemaBench |
||
18 | { |
||
19 | /** @var SchemaGenerator */ |
||
20 | private $schemaBuilder; |
||
21 | |||
22 | private $schema; |
||
23 | |||
24 | /** @var string */ |
||
25 | private $smallQuery; |
||
26 | |||
27 | public function setUp() |
||
28 | { |
||
29 | $this->schemaBuilder = new SchemaGenerator([ |
||
30 | 'totalTypes' => 600, |
||
31 | 'fieldsPerType' => 8, |
||
32 | 'listFieldsPerType' => 2, |
||
33 | 'nestingLevel' => 10, |
||
34 | ]); |
||
35 | |||
36 | $this->schema = $this->schemaBuilder->buildSchema(); |
||
37 | |||
38 | $queryBuilder = new QueryGenerator($this->schema, 0.05); |
||
39 | $this->smallQuery = $queryBuilder->buildQuery(); |
||
40 | } |
||
41 | |||
42 | public function benchSchema() |
||
43 | { |
||
44 | $this->schemaBuilder |
||
45 | ->buildSchema() |
||
46 | ->getTypeMap(); |
||
47 | } |
||
48 | |||
49 | public function benchSchemaLazy() |
||
50 | { |
||
51 | $this->createLazySchema(); |
||
52 | } |
||
53 | |||
54 | public function benchSmallQuery() |
||
55 | { |
||
56 | $result = GraphQL::executeQuery($this->schema, $this->smallQuery); |
||
|
|||
57 | } |
||
58 | |||
59 | public function benchSmallQueryLazy() |
||
63 | } |
||
64 | |||
65 | private function createLazySchema() |
||
72 | }) |
||
73 | ); |
||
74 | } |
||
75 | } |
||
76 |