1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Samsara\Fermat\Bench\Providers; |
4
|
|
|
|
5
|
|
|
use PhpBench\Attributes\Groups; |
6
|
|
|
use PhpBench\Attributes\Revs; |
7
|
|
|
use Samsara\Fermat\Provider\ConstantProvider; |
8
|
|
|
|
9
|
|
|
class ConstantProviderBench |
10
|
|
|
{ |
11
|
|
|
|
12
|
|
|
#[Groups(['logs', 'constants', 'providers', 'easy'])] |
13
|
|
|
#[Revs(1000)] |
14
|
|
|
public function benchMakeLn2Easy() |
15
|
|
|
{ |
16
|
|
|
ConstantProvider::makeLn2(5); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
#[Groups(['logs', 'constants', 'providers', 'medium'])] |
20
|
|
|
#[Revs(500)] |
21
|
|
|
public function benchMakeLn2Medium() |
22
|
|
|
{ |
23
|
|
|
ConstantProvider::makeLn2(50); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
#[Groups(['logs', 'constants', 'providers', 'hard'])] |
27
|
|
|
#[Revs(500)] |
28
|
|
|
public function benchMakeLn2Hard() |
29
|
|
|
{ |
30
|
|
|
ConstantProvider::makeLn2(500); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
#[Groups(['logs', 'constants', 'providers', 'easy'])] |
34
|
|
|
#[Revs(2000)] |
35
|
|
|
public function benchMakeLn1p1Easy() |
36
|
|
|
{ |
37
|
|
|
ConstantProvider::makeLn1p1(5); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
#[Groups(['logs', 'constants', 'providers', 'medium'])] |
41
|
|
|
#[Revs(2000)] |
42
|
|
|
public function benchMakeLn1p1Medium() |
43
|
|
|
{ |
44
|
|
|
ConstantProvider::makeLn1p1(50); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
#[Groups(['logs', 'constants', 'providers', 'hard'])] |
48
|
|
|
#[Revs(2000)] |
49
|
|
|
public function benchMakeLn1p1Hard() |
50
|
|
|
{ |
51
|
|
|
ConstantProvider::makeLn1p1(500); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
#[Groups(['logs', 'constants', 'providers', 'easy'])] |
55
|
|
|
#[Revs(1000)] |
56
|
|
|
public function benchMakeLn10Easy() |
57
|
|
|
{ |
58
|
|
|
ConstantProvider::makeLn10(5); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
#[Groups(['logs', 'constants', 'providers', 'medium'])] |
62
|
|
|
#[Revs(500)] |
63
|
|
|
public function benchMakeLn10Medium() |
64
|
|
|
{ |
65
|
|
|
ConstantProvider::makeLn10(50); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
#[Groups(['logs', 'constants', 'providers', 'hard'])] |
69
|
|
|
#[Revs(50)] |
70
|
|
|
public function benchMakeLn10Hard() |
71
|
|
|
{ |
72
|
|
|
ConstantProvider::makeLn10(200); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
#[Groups(['trig', 'constants', 'providers', 'easy'])] |
76
|
|
|
#[Revs(500)] |
77
|
|
|
public function benchMakePiEasy() |
78
|
|
|
{ |
79
|
|
|
ConstantProvider::makePi(5); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
#[Groups(['trig', 'constants', 'providers', 'easy'])] |
83
|
|
|
#[Revs(500)] |
84
|
|
|
public function benchMakePiMedium() |
85
|
|
|
{ |
86
|
|
|
ConstantProvider::makePi(50); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
#[Groups(['trig', 'constants', 'providers', 'easy'])] |
90
|
|
|
#[Revs(50)] |
91
|
|
|
public function benchMakePiHard() |
92
|
|
|
{ |
93
|
|
|
ConstantProvider::makePi(500); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
#[Groups(['logs', 'constants', 'providers', 'easy'])] |
97
|
|
|
#[Revs(500)] |
98
|
|
|
public function benchMakeEEasy() |
99
|
|
|
{ |
100
|
|
|
ConstantProvider::makeE(5); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
#[Groups(['logs', 'constants', 'providers', 'medium'])] |
104
|
|
|
#[Revs(500)] |
105
|
|
|
public function benchMakeEMedium() |
106
|
|
|
{ |
107
|
|
|
ConstantProvider::makeE(50); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
#[Groups(['logs', 'constants', 'providers', 'hard'])] |
111
|
|
|
#[Revs(50)] |
112
|
|
|
public function benchMakeEHard() |
113
|
|
|
{ |
114
|
|
|
ConstantProvider::makeE(500); |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
} |