summaryrefslogtreecommitdiff
path: root/maintenance/benchmarks/bench_if_switch.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /maintenance/benchmarks/bench_if_switch.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'maintenance/benchmarks/bench_if_switch.php')
-rw-r--r--maintenance/benchmarks/bench_if_switch.php89
1 files changed, 52 insertions, 37 deletions
diff --git a/maintenance/benchmarks/bench_if_switch.php b/maintenance/benchmarks/bench_if_switch.php
index 80fd9623..698a0f0a 100644
--- a/maintenance/benchmarks/bench_if_switch.php
+++ b/maintenance/benchmarks/bench_if_switch.php
@@ -31,8 +31,7 @@ require_once __DIR__ . '/Benchmarker.php';
*
* @ingroup Maintenance
*/
-class bench_if_switch extends Benchmarker {
-
+class BenchIfSwitch extends Benchmarker {
public function __construct() {
parent::__construct();
$this->mDescription = "Benchmark if elseif... versus switch case.";
@@ -42,55 +41,71 @@ class bench_if_switch extends Benchmarker {
$this->bench( array(
array( 'function' => array( $this, 'doElseIf' ) ),
array( 'function' => array( $this, 'doSwitch' ) ),
- ));
+ ) );
print $this->getFormattedResults();
}
// bench function 1
function doElseIf() {
$a = 'z';
- if( $a == 'a') {}
- elseif( $a == 'b') {}
- elseif( $a == 'c') {}
- elseif( $a == 'd') {}
- elseif( $a == 'e') {}
- elseif( $a == 'f') {}
- elseif( $a == 'g') {}
- elseif( $a == 'h') {}
- elseif( $a == 'i') {}
- elseif( $a == 'j') {}
- elseif( $a == 'k') {}
- elseif( $a == 'l') {}
- elseif( $a == 'm') {}
- elseif( $a == 'n') {}
- elseif( $a == 'o') {}
- elseif( $a == 'p') {}
- else {}
+ if ( $a == 'a' ) {
+ } elseif ( $a == 'b' ) {
+ } elseif ( $a == 'c' ) {
+ } elseif ( $a == 'd' ) {
+ } elseif ( $a == 'e' ) {
+ } elseif ( $a == 'f' ) {
+ } elseif ( $a == 'g' ) {
+ } elseif ( $a == 'h' ) {
+ } elseif ( $a == 'i' ) {
+ } elseif ( $a == 'j' ) {
+ } elseif ( $a == 'k' ) {
+ } elseif ( $a == 'l' ) {
+ } elseif ( $a == 'm' ) {
+ } elseif ( $a == 'n' ) {
+ } elseif ( $a == 'o' ) {
+ } elseif ( $a == 'p' ) {
+ } else {
+ }
}
// bench function 2
function doSwitch() {
$a = 'z';
- switch( $a ) {
- case 'b': break;
- case 'c': break;
- case 'd': break;
- case 'e': break;
- case 'f': break;
- case 'g': break;
- case 'h': break;
- case 'i': break;
- case 'j': break;
- case 'k': break;
- case 'l': break;
- case 'm': break;
- case 'n': break;
- case 'o': break;
- case 'p': break;
+ switch ( $a ) {
+ case 'b':
+ break;
+ case 'c':
+ break;
+ case 'd':
+ break;
+ case 'e':
+ break;
+ case 'f':
+ break;
+ case 'g':
+ break;
+ case 'h':
+ break;
+ case 'i':
+ break;
+ case 'j':
+ break;
+ case 'k':
+ break;
+ case 'l':
+ break;
+ case 'm':
+ break;
+ case 'n':
+ break;
+ case 'o':
+ break;
+ case 'p':
+ break;
default:
}
}
}
-$maintClass = 'bench_if_switch';
+$maintClass = 'BenchIfSwitch';
require_once RUN_MAINTENANCE_IF_MAIN;