From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- maintenance/benchmarks/bench_if_switch.php | 88 ++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 maintenance/benchmarks/bench_if_switch.php (limited to 'maintenance/benchmarks/bench_if_switch.php') 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 @@ +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 ); -- cgit v1.2.3-54-g00ecf