Index: trunk/phase3/maintenance/benchmarks/benchmarkHooks.php |
— | — | @@ -44,20 +44,33 @@ |
45 | 45 | }
|
46 | 46 | $time = $this->benchHooks();
|
47 | 47 | $this->output( 'Loaded (ten) hook: ' . $time . "\n" );
|
| 48 | +
|
| 49 | + for( $i = 0; $i < 90; $i++ ) {
|
| 50 | + $wgHooks['Test'][] = array( $this, 'test' );
|
| 51 | + }
|
| 52 | + $time = $this->benchHooks();
|
| 53 | + $this->output( 'Loaded (ten) hook: ' . $time . "\n" );
|
48 | 54 | $this->output( "\n" );
|
49 | 55 | }
|
50 | 56 |
|
51 | | - private function benchHooks( $trials = 1 ) {
|
| 57 | + /**
|
| 58 | + * @param $trials int
|
| 59 | + * @return string
|
| 60 | + */
|
| 61 | + private function benchHooks( $trials = 10 ) {
|
52 | 62 | $start = wfTime();
|
53 | 63 | for ( $i = 0; $i < $trials; $i++ ) {
|
54 | 64 | wfRunHooks( 'Test' );
|
55 | 65 | }
|
56 | 66 | $delta = wfTime() - $start;
|
57 | 67 | $pertrial = $delta / $trials;
|
58 | | - return sprintf( "Took %6.2fms",
|
| 68 | + return sprintf( "Took %6.2fs",
|
59 | 69 | $pertrial );
|
60 | 70 | }
|
61 | 71 |
|
| 72 | + /**
|
| 73 | + * @return bool
|
| 74 | + */
|
62 | 75 | public function test() {
|
63 | 76 | return true;
|
64 | 77 | }
|