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