From: Tim Starling Date: Tue, 31 May 2011 06:10:23 +0000 (+0000) Subject: * Use Preprocessor_Hash by default in compiled mode, it is faster X-Git-Tag: 1.31.0-rc.0~29829 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=67099169ad567385f6319a59e294bbf8678991a5;p=lhc%2Fweb%2Fwiklou.git * 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. --- diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 99bd0865e0..d15793802b 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -197,13 +197,11 @@ class MagicWord { * @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 @@ class MagicWord { */ function load( $id ) { global $wgContLang; + wfProfileIn( __METHOD__ ); $this->mId = $id; $wgContLang->getMagic( $this ); if ( !$this->mSynonyms ) { @@ -282,6 +281,7 @@ class MagicWord { #throw new MWException( "Error: invalid magic word '$id'" ); wfDebugLog( 'exception', "Error: invalid magic word '$id'\n" ); } + wfProfileOut( __METHOD__ ); } /** diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 010da1f5e6..c72c49acfa 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -187,6 +187,9 @@ class Parser { '[^][<>"\\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 @@ class Parser { } else { $this->mPreprocessorClass = 'Preprocessor_Hash'; } + wfDebug( __CLASS__ . ": using preprocessor: {$this->mPreprocessorClass}\n" ); } /**