Total Complexity | 3 |
Total Lines | 65 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class ConsumeBench |
||
9 | { |
||
10 | /** |
||
11 | * @var ByteBuffer |
||
12 | */ |
||
13 | private $buffer; |
||
14 | |||
15 | /** |
||
16 | * @var int |
||
17 | */ |
||
18 | private $revs = 1000; |
||
19 | |||
20 | /** |
||
21 | * @return void |
||
22 | */ |
||
23 | public function init(): void |
||
24 | { |
||
25 | $this->buffer = new ByteBuffer; |
||
26 | |||
27 | for ($i = 0; $i < $this->revs; ++$i) { |
||
28 | $this->buffer |
||
29 | ->appendInt8(1) |
||
30 | ->appendInt16(1) |
||
31 | ->appendInt32(1) |
||
32 | ->appendInt64(1) |
||
33 | ->appendUint8(1) |
||
34 | ->appendUint16(1) |
||
35 | ->appendUint32(1) |
||
36 | ->appendUint64(1) |
||
37 | ->appendFloat(1.1) |
||
38 | ->appendFloat(-1.1) |
||
39 | ->appendFloat(\M_PI) |
||
40 | ->appendDouble(1.1) |
||
41 | ->appendDouble(-1.1) |
||
42 | ->appendDouble(\M_PI) |
||
43 | ->append('some string') |
||
44 | ->append("other string") |
||
45 | ; |
||
46 | } |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @Revs(1000) |
||
51 | * @Iterations(100) |
||
52 | * |
||
53 | * @return void |
||
54 | */ |
||
55 | public function benchConsume(): void |
||
73 | } |
||
74 | } |
||
75 |