From 472ce1456fe98b8ff20b1429b8f19e75bfb3e117 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 16 Oct 2011 03:32:39 +0000 Subject: [PATCH] svn:eol-style native --- maintenance/benchmarks/benchmarkHooks.php | 160 +++++++++++----------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/maintenance/benchmarks/benchmarkHooks.php b/maintenance/benchmarks/benchmarkHooks.php index ec11c2f8bd..d614423bed 100644 --- a/maintenance/benchmarks/benchmarkHooks.php +++ b/maintenance/benchmarks/benchmarkHooks.php @@ -1,80 +1,80 @@ -mDescription = "Benchmark MediaWiki Hooks."; - } - - public function execute() { - global $wgHooks; - $wgHooks['Test'] = array(); - - $time = $this->benchHooks(); - $this->output( 'Empty hook: ' . $time . "\n" ); - - $wgHooks['Test'][] = array( $this, 'test' ); - $time = $this->benchHooks(); - $this->output( 'Loaded (one) hook: ' . $time . "\n" ); - - for( $i = 0; $i < 9; $i++ ) { - $wgHooks['Test'][] = array( $this, 'test' ); - } - $time = $this->benchHooks(); - $this->output( 'Loaded (ten) hook: ' . $time . "\n" ); - - for( $i = 0; $i < 90; $i++ ) { - $wgHooks['Test'][] = array( $this, 'test' ); - } - $time = $this->benchHooks(); - $this->output( 'Loaded (one hundred) hook: ' . $time . "\n" ); - $this->output( "\n" ); - } - - /** - * @param $trials int - * @return string - */ - private function benchHooks( $trials = 10 ) { - $start = wfTime(); - for ( $i = 0; $i < $trials; $i++ ) { - wfRunHooks( 'Test' ); - } - $delta = wfTime() - $start; - $pertrial = $delta / $trials; - return sprintf( "Took %6.2fs", - $pertrial ); - } - - /** - * @return bool - */ - public function test() { - return true; - } -} - -$maintClass = "BenchmarkHooks"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +mDescription = "Benchmark MediaWiki Hooks."; + } + + public function execute() { + global $wgHooks; + $wgHooks['Test'] = array(); + + $time = $this->benchHooks(); + $this->output( 'Empty hook: ' . $time . "\n" ); + + $wgHooks['Test'][] = array( $this, 'test' ); + $time = $this->benchHooks(); + $this->output( 'Loaded (one) hook: ' . $time . "\n" ); + + for( $i = 0; $i < 9; $i++ ) { + $wgHooks['Test'][] = array( $this, 'test' ); + } + $time = $this->benchHooks(); + $this->output( 'Loaded (ten) hook: ' . $time . "\n" ); + + for( $i = 0; $i < 90; $i++ ) { + $wgHooks['Test'][] = array( $this, 'test' ); + } + $time = $this->benchHooks(); + $this->output( 'Loaded (one hundred) hook: ' . $time . "\n" ); + $this->output( "\n" ); + } + + /** + * @param $trials int + * @return string + */ + private function benchHooks( $trials = 10 ) { + $start = wfTime(); + for ( $i = 0; $i < $trials; $i++ ) { + wfRunHooks( 'Test' ); + } + $delta = wfTime() - $start; + $pertrial = $delta / $trials; + return sprintf( "Took %6.2fs", + $pertrial ); + } + + /** + * @return bool + */ + public function test() { + return true; + } +} + +$maintClass = "BenchmarkHooks"; +require_once( RUN_MAINTENANCE_IF_MAIN ); -- 2.20.1