| @@ 21-65 (lines=45) @@ | ||
| 18 | * @Revs(2500) |
|
| 19 | * @Iterations(25) |
|
| 20 | */ |
|
| 21 | class ExplicitEnumBench implements SegregateEnumBench |
|
| 22 | { |
|
| 23 | public function benchInit() |
|
| 24 | { |
|
| 25 | $a = AbcExp::byValue(AbcExp::A); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function benchCompareSelf() |
|
| 29 | { |
|
| 30 | $a = AbcExp::byValue(AbcExp::A); |
|
| 31 | $a->equals(AbcExp::byValue(AbcExp::A)); |
|
| 32 | } |
|
| 33 | ||
| 34 | public function benchInitTwice() |
|
| 35 | { |
|
| 36 | $a = AbcExp::byValue(AbcExp::A); |
|
| 37 | $z = AbcExp::byValue(AbcExp::A); |
|
| 38 | } |
|
| 39 | ||
| 40 | public function benchInitTwiceDifferentValue() |
|
| 41 | { |
|
| 42 | $a = AbcExp::byValue(AbcExp::A); |
|
| 43 | $b = AbcExp::byValue(AbcExp::B); |
|
| 44 | } |
|
| 45 | ||
| 46 | public function benchCompareDifferent() |
|
| 47 | { |
|
| 48 | AbcExp::byValue(AbcExp::A)->equals(AbcExp::byValue(AbcExp::B)); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function benchToString() |
|
| 52 | { |
|
| 53 | $c = (string) AbcExp::byValue(AbcExp::C); |
|
| 54 | } |
|
| 55 | ||
| 56 | public function benchBuildChoices() |
|
| 57 | { |
|
| 58 | AbcExp::choices(); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function benchBuildValues() |
|
| 62 | { |
|
| 63 | AbcExp::values(); |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 21-65 (lines=45) @@ | ||
| 18 | * @Revs(2500) |
|
| 19 | * @Iterations(25) |
|
| 20 | */ |
|
| 21 | class MabeNoMagicEnumBench implements SegregateEnumBench |
|
| 22 | { |
|
| 23 | public function benchInit() |
|
| 24 | { |
|
| 25 | $d = DefMarcMabe::byValue(DefMarcMabe::D); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function benchCompareSelf() |
|
| 29 | { |
|
| 30 | $d = DefMarcMabe::byValue(DefMarcMabe::D); |
|
| 31 | $d->is(DefMarcMabe::byValue(DefMarcMabe::D)); |
|
| 32 | } |
|
| 33 | ||
| 34 | public function benchInitTwice() |
|
| 35 | { |
|
| 36 | $d = DefMarcMabe::byValue(DefMarcMabe::D); |
|
| 37 | $z = DefMarcMabe::byValue(DefMarcMabe::D); |
|
| 38 | } |
|
| 39 | ||
| 40 | public function benchInitTwiceDifferentValue() |
|
| 41 | { |
|
| 42 | $d = DefMarcMabe::byValue(DefMarcMabe::D); |
|
| 43 | $e = DefMarcMabe::byValue(DefMarcMabe::E); |
|
| 44 | } |
|
| 45 | ||
| 46 | public function benchCompareDifferent() |
|
| 47 | { |
|
| 48 | DefMarcMabe::byValue(DefMarcMabe::D)->is(DefMarcMabe::byValue(DefMarcMabe::E)); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function benchToString() |
|
| 52 | { |
|
| 53 | $f = (string) DefMarcMabe::F(); |
|
| 54 | } |
|
| 55 | ||
| 56 | public function benchBuildChoices() |
|
| 57 | { |
|
| 58 | DefMarcMabe::choices(); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function benchBuildValues() |
|
| 62 | { |
|
| 63 | DefMarcMabe::values(); |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 21-65 (lines=45) @@ | ||
| 18 | * @Revs(2500) |
|
| 19 | * @Iterations(25) |
|
| 20 | */ |
|
| 21 | class ReflectionEnumNoMagicBench implements SegregateEnumBench |
|
| 22 | { |
|
| 23 | public function benchInit() |
|
| 24 | { |
|
| 25 | $d = DefRef::byValue(DefRef::D); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function benchCompareSelf() |
|
| 29 | { |
|
| 30 | $d = DefRef::byValue(DefRef::D); |
|
| 31 | $d->equals(DefRef::byValue(DefRef::D)); |
|
| 32 | } |
|
| 33 | ||
| 34 | public function benchInitTwice() |
|
| 35 | { |
|
| 36 | $d = DefRef::byValue(DefRef::D); |
|
| 37 | $z = DefRef::byValue(DefRef::D); |
|
| 38 | } |
|
| 39 | ||
| 40 | public function benchInitTwiceDifferentValue() |
|
| 41 | { |
|
| 42 | $d = DefRef::byValue(DefRef::D); |
|
| 43 | $e = DefRef::byValue(DefRef::E); |
|
| 44 | } |
|
| 45 | ||
| 46 | public function benchCompareDifferent() |
|
| 47 | { |
|
| 48 | DefRef::byValue(DefRef::D)->equals(DefRef::byValue(DefRef::E)); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function benchToString() |
|
| 52 | { |
|
| 53 | $f = (string) DefRef::byValue(DefRef::F); |
|
| 54 | } |
|
| 55 | ||
| 56 | public function benchBuildChoices() |
|
| 57 | { |
|
| 58 | DefRef::choices(); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function benchBuildValues() |
|
| 62 | { |
|
| 63 | DefRef::values(); |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||