From: Brion Vibber Date: Mon, 22 Nov 2004 10:05:11 +0000 (+0000) Subject: Inner loop optimization: reverse order of conditions for language variant link check... X-Git-Tag: 1.5.0alpha1~1272 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=f8c3d4bfb41b9d4267c98a7c078e0f1a6beebfdf;p=lhc%2Fweb%2Fwiklou.git Inner loop optimization: reverse order of conditions for language variant link check, so the condition short-circuits correctly and we can skip the expensive per-link lookup. --- diff --git a/includes/Parser.php b/includes/Parser.php index d25a27b9d6..3a17300d6b 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1167,8 +1167,8 @@ class Parser # Loop for each link for ($k = 0; isset( $a[$k] ); $k++) { $line = $a[$k]; - wfProfileIn( $fname.'-prefixhandling' ); if ( $useLinkPrefixExtension ) { + wfProfileIn( $fname.'-prefixhandling' ); if ( preg_match( $e2, $s, $m ) ) { $prefix = $m[2]; $s = $m[1]; @@ -1180,8 +1180,8 @@ class Parser $prefix = $first_prefix; $first_prefix = false; } + wfProfileOut( $fname.'-prefixhandling' ); } - wfProfileOut( $fname.'-prefixhandling' ); $might_be_img = false; @@ -1225,8 +1225,8 @@ class Parser #check other language variants of the link #if the article does not exist - if( $nt->getArticleID() == 0 - && $checkVariantLink ) { + if( $checkVariantLink + && $nt->getArticleID() == 0 ) { $wgContLang->findVariantLink($link, $nt); } @@ -3137,7 +3137,6 @@ class ParserOptions # Get user options function initialiseFromUser( &$userInput ) { global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages; - $fname = 'ParserOptions::initialiseFromUser'; wfProfileIn( $fname ); if ( !$userInput ) {