diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
commit | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch) | |
tree | ec04cc15b867bc21eedca904cea9af0254531a11 /maintenance/benchmarks/bench_if_switch.php | |
parent | a22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff) |
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook
* Use only css to hide our menu bar when printing
Diffstat (limited to 'maintenance/benchmarks/bench_if_switch.php')
-rw-r--r-- | maintenance/benchmarks/bench_if_switch.php | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/maintenance/benchmarks/bench_if_switch.php b/maintenance/benchmarks/bench_if_switch.php new file mode 100644 index 00000000..11c00b3c --- /dev/null +++ b/maintenance/benchmarks/bench_if_switch.php @@ -0,0 +1,88 @@ +<?php +/** + * This come from r75429 message + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + * @ingroup Maintenance + * @author Platonides + */ + +require_once( dirname( __FILE__ ) . '/Benchmarker.php' ); +class bench_if_switch extends Benchmarker { + + public function __construct() { + parent::__construct(); + $this->mDescription = "Benchmark if elseif... versus switch case."; + } + + public function execute() { + $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 {} + } + + // 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; + default: + } + } +} + +$maintClass = 'bench_if_switch'; +require_once( RUN_MAINTENANCE_IF_MAIN ); |