-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHardTest.php
More file actions
35 lines (25 loc) · 714 Bytes
/
HardTest.php
File metadata and controls
35 lines (25 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
declare(strict_types=1);
namespace Tests\Benchmark;
use Tests\TestCase;
class HardTest extends TestCase
{
protected string $lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras efficitur nisi in scelerisque ultricies.';
protected int $count = 100000;
public function testMemory(): void
{
$this->benchmark()->iterations(10)->compare(
fn () => $this->process(),
fn () => $this->process()
);
$this->assertTrue(true);
}
protected function process(): array
{
$result = [];
for ($i = 0; $i < $this->count; ++$i) {
$result[] = $this->lorem;
}
return $result;
}
}