9a2888638793912972ec9546998944b25e7a2b59
3 require_once( dirname( __FILE__
) . '/Benchmarker.php' );
4 class bench_strtr_str_replace
extends Benchmarker
{
6 public function __construct() {
8 $this->mDescription
= "Benchmark for strtr() vs str_replace().";
11 public function execute() {
13 array( 'function' => array( $this, 'benchstrtr' ) ),
14 array( 'function' => array( $this, 'benchstr_replace' ) ),
16 print $this->getFormattedResults();
19 function benchstrtr() {
20 strtr( "[[MediaWiki:Some_random_test_page]]", "_", "" );
23 function benchstr_replace() {
24 str_replace( "_", " ", "[[MediaWiki:Some_random_test_page]]");
29 $maintClass = 'bench_strtr_str_replace';
30 require_once( DO_MAINTENANCE
);