http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89207
Revision: 89207
Author: tstarling
Date: 2011-05-31 06:10:23 +0000 (Tue, 31 May 2011)
Log Message:
-----------
* Use Preprocessor_Hash by default in compiled mode, it is faster
* Don't profile MagicWord::get(), it is very fast and the profiling overhead
was excessive. Profile MagicWord::load() instead.
Modified Paths:
--------------
trunk/phase3/includes/MagicWord.php
trunk/phase3/includes/parser/Parser.php
Modified: trunk/phase3/includes/MagicWord.php
===================================================================
--- trunk/phase3/includes/MagicWord.php 2011-05-31 06:05:05 UTC (rev 89206)
+++ trunk/phase3/includes/MagicWord.php 2011-05-31 06:10:23 UTC (rev 89207)
@@ -197,13 +197,11 @@
* @return MagicWord
*/
static function &get( $id ) {
- wfProfileIn( __METHOD__ );
if ( !isset( self::$mObjects[$id] ) ) {
$mw = new MagicWord();
$mw->load( $id );
self::$mObjects[$id] = $mw;
}
- wfProfileOut( __METHOD__ );
return self::$mObjects[$id];
}
@@ -275,6 +273,7 @@
*/
function load( $id ) {
global $wgContLang;
+ wfProfileIn( __METHOD__ );
$this->mId = $id;
$wgContLang->getMagic( $this );
if ( !$this->mSynonyms ) {
@@ -282,6 +281,7 @@
#throw new MWException( "Error: invalid magic word
'$id'" );
wfDebugLog( 'exception', "Error: invalid magic word
'$id'\n" );
}
+ wfProfileOut( __METHOD__ );
}
/**
Modified: trunk/phase3/includes/parser/Parser.php
===================================================================
--- trunk/phase3/includes/parser/Parser.php 2011-05-31 06:05:05 UTC (rev
89206)
+++ trunk/phase3/includes/parser/Parser.php 2011-05-31 06:10:23 UTC (rev
89207)
@@ -187,6 +187,9 @@
'[^][<>"\\x00-\\x20\\x7F]+)
*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]/S';
if ( isset( $conf['preprocessorClass'] ) ) {
$this->mPreprocessorClass = $conf['preprocessorClass'];
+ } elseif ( defined( 'MW_COMPILED' ) ) {
+ # Preprocessor_Hash is much faster than
Preprocessor_DOM in compiled mode
+ $this->mPreprocessorClass = 'Preprocessor_Hash';
} elseif ( extension_loaded( 'domxml' ) ) {
# PECL extension that conflicts with the core DOM
extension (bug 13770)
wfDebug( "Warning: you have the obsolete domxml
extension for PHP. Please remove it!\n" );
@@ -196,6 +199,7 @@
} else {
$this->mPreprocessorClass = 'Preprocessor_Hash';
}
+ wfDebug( __CLASS__ . ": using preprocessor:
{$this->mPreprocessorClass}\n" );
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs