Skip to content

Commit f749594

Browse files
committed
better bench
1 parent cedf4d0 commit f749594

File tree

3 files changed

+16
-65
lines changed

3 files changed

+16
-65
lines changed

bench/EnumSet32Bench.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,28 +82,14 @@ public function benchDetachValue()
8282
}
8383
}
8484

85-
public function benchContainsEnumeratorTrue()
85+
public function benchContainsEnumerator()
8686
{
8787
foreach ($this->enumerators as $enumerator) {
8888
$this->fullSet->contains($enumerator);
8989
}
9090
}
9191

92-
public function benchContainsEnumeratorFalse()
93-
{
94-
foreach ($this->enumerators as $enumerator) {
95-
$this->fullSet->contains($enumerator);
96-
}
97-
}
98-
99-
public function benchContainsValueTrue()
100-
{
101-
foreach ($this->values as $value) {
102-
$this->fullSet->contains($value);
103-
}
104-
}
105-
106-
public function benchContainsValueFalse()
92+
public function benchContainsValue()
10793
{
10894
foreach ($this->values as $value) {
10995
$this->fullSet->contains($value);

bench/EnumSet66Bench.php

Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -54,84 +54,42 @@ public function init()
5454
}
5555
}
5656

57-
public function benchAttachEnumeratorOnEmpty()
57+
public function benchAttachEnumerator()
5858
{
5959
foreach ($this->enumerators as $enumerator) {
6060
$this->emptySet->attach($enumerator);
6161
}
6262
}
6363

64-
public function benchAttachValueOnEmpty()
64+
public function benchAttachValue()
6565
{
6666
foreach ($this->values as $value) {
6767
$this->emptySet->attach($value);
6868
}
6969
}
7070

71-
public function benchAttachEnumeratorOnFull()
72-
{
73-
foreach ($this->enumerators as $enumerator) {
74-
$this->fullSet->attach($enumerator);
75-
}
76-
}
77-
78-
public function benchAttachValueOnFull()
79-
{
80-
foreach ($this->values as $value) {
81-
$this->fullSet->attach($value);
82-
}
83-
}
84-
85-
public function benchDetachEnumeratorOnEmpty()
71+
public function benchDetachEnumerator()
8672
{
8773
foreach ($this->enumerators as $enumerator) {
8874
$this->emptySet->detach($enumerator);
8975
}
9076
}
9177

92-
public function benchDetachValueOnEmpty()
78+
public function benchDetachValue()
9379
{
9480
foreach ($this->values as $value) {
9581
$this->emptySet->detach($value);
9682
}
9783
}
9884

99-
public function benchDetachEnumeratorOnFull()
100-
{
101-
foreach ($this->enumerators as $enumerator) {
102-
$this->fullSet->detach($enumerator);
103-
}
104-
}
105-
106-
public function benchDetachValueOnFull()
107-
{
108-
foreach ($this->values as $value) {
109-
$this->fullSet->detach($value);
110-
}
111-
}
112-
113-
public function benchContainsEnumeratorTrue()
114-
{
115-
foreach ($this->enumerators as $enumerator) {
116-
$this->fullSet->contains($enumerator);
117-
}
118-
}
119-
120-
public function benchContainsValueTrue()
121-
{
122-
foreach ($this->values as $value) {
123-
$this->fullSet->contains($value);
124-
}
125-
}
126-
127-
public function benchContainsEnumeratorFalse()
85+
public function benchContainsEnumerator()
12886
{
12987
foreach ($this->enumerators as $enumerator) {
13088
$this->fullSet->contains($enumerator);
13189
}
13290
}
13391

134-
public function benchContainsValueFalse()
92+
public function benchContainsValue()
13593
{
13694
foreach ($this->values as $value) {
13795
$this->fullSet->contains($value);

phpbench.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{
22
"bootstrap": "bench/bootstrap.php",
33
"path": "bench/",
4-
"retry_threshold": 5
4+
"retry_threshold": 2,
5+
"php_disable_ini": true,
6+
"php_config": {
7+
"zend_extension": ["opcache.so"],
8+
"extension": [ "json.so" ],
9+
"zend.assertions": -1,
10+
"opcache.enable_cli": 1
11+
}
512
}

0 commit comments

Comments
 (0)