forked from Respect/Validation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidatorBench.php
More file actions
43 lines (36 loc) · 1.23 KB
/
ValidatorBench.php
File metadata and controls
43 lines (36 loc) · 1.23 KB
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
36
37
38
39
40
41
42
43
<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
namespace Respect\Validation\Benchmarks;
use PhpBench\Attributes as Bench;
use Respect\Validation\Test\SmokeTestProvider;
use Respect\Validation\Validator;
class ValidatorBench
{
use SmokeTestProvider;
/** @param array<Validator, mixed> $params */
#[Bench\ParamProviders(['provideValidatorInput'])]
#[Bench\BeforeMethods('setFileUploadMock')]
#[Bench\Iterations(10)]
#[Bench\RetryThreshold(5)]
#[Bench\Revs(5)]
#[Bench\Warmup(1)]
#[Bench\Assert('mode(variant.time.avg) < mode(baseline.time.avg) +/- 10%')]
#[Bench\Assert('mode(variant.time.net) < mode(baseline.time.net) +/- 10%')]
#[Bench\Assert('mode(variant.mem.peak) < mode(baseline.mem.peak) +/- 10%')]
#[Bench\Assert('mode(variant.mem.real) < mode(baseline.mem.real) +/- 10%')]
#[Bench\Assert('mode(variant.mem.final) < mode(baseline.mem.final) +/- 10%')]
#[Bench\Subject]
public function evaluate(array $params): void
{
[$v, $input] = $params;
$v->evaluate($input);
}
public function setFileUploadMock(): void
{
set_mock_is_uploaded_file_return(true);
}
}