Profiling/grof scripts
Appearance
Scripts for Profiling/gprof 20051105:
Parse
[edit]<?php require_once( 'commandLine.inc' ); $text = file_get_contents( dirname(__FILE__).'/benchmark/test.txt' ); $zhtext = file_get_contents( dirname(__FILE__).'/benchmark/zhtest.txt' ); $po = new ParserOptions; $wgUseImageResize = false; # Fill cache $wgParser->parse( $text, $wgTitle, $po ); #$wgDebugLogFile = '/dev/stdout'; foreach ( $wgLoadBalancer->mServers as $i => $server ) { $wgLoadBalancer->mServers[$i]['flags'] |= DBO_DEBUG; } $n = 20; $t = -wfTime(); for ($j=0; $j<$n; $j++) { $wgParser->parse( $text, $wgTitle, $po ); } $t += wfTime(); print $t / $n * 1000 . " ms\n"; ?>
Skin
[edit]<?php require_once('../commandLine.inc'); error_reporting( E_ERROR ); for ( $i=0; $i<1000; $i++ ) { print "$i "; ob_start(); $wgOut->addHTML("Test"); $wgOut->output(); ob_end_clean(); } print "\n"; ?>