From: Chad Horohoe Date: Thu, 8 Jul 2010 17:01:28 +0000 (+0000) Subject: (bug 24124) Diffs are taking 10 to 20 seconds to load. Use parser cache for page... X-Git-Tag: 1.31.0-rc.0~36202 X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=commitdiff_plain;h=5be8547151ce08ee255780412bcb88a9771efce3;p=lhc%2Fweb%2Fwiklou.git (bug 24124) Diffs are taking 10 to 20 seconds to load. Use parser cache for page preview when diffing to current version (which is the most often). Cuts execution time down on my sample page from 1141.44ms down to 13.78ms on a pcache hit --- diff --git a/includes/diff/DifferenceInterface.php b/includes/diff/DifferenceInterface.php index 617f39ac5a..d44823c4be 100644 --- a/includes/diff/DifferenceInterface.php +++ b/includes/diff/DifferenceInterface.php @@ -421,8 +421,10 @@ CONTROL; $wgOut->wrapWikiMsg( "\n", 'rev-deleted-text-view' ); } + $pCache = true; if( !$this->mNewRev->isCurrent() ) { $oldEditSectionSetting = $wgOut->parserOptions()->setEditSection( false ); + $pCache = false; } $this->loadNewText(); @@ -441,6 +443,13 @@ CONTROL; $wgOut->addHTML( htmlspecialchars( $this->mNewtext ) ); $wgOut->addHTML( "\n\n" ); } + } elseif( $pCache ) { + $pOutput = ParserCache::singleton()->get( new Article( $this->mTitle ), $wgUser ); + if( $pOutput ) { + $wgOut->addHtml( $pOutput->getText() ); + } else { + $wgOut->addWikiTextTidy( $this->mNewtext ); + } } else { $wgOut->addWikiTextTidy( $this->mNewtext ); }