From 5be8547151ce08ee255780412bcb88a9771efce3 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 8 Jul 2010 17:01:28 +0000 Subject: [PATCH] (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 --- includes/diff/DifferenceInterface.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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 ); } -- 2.20.1