Parsoid: don't bypass ParserCache when using Title

We were bypassing the ParserCache when the page was given as a Title
instead of a RevisionRecord, because
ParsoidOutputAccess::getParserOutput used to require a RevisionRecord.
This is no longer the case (per a02be0b3f8).

This fixes a performance issue with VisuaEditor: since VE passes a Title
object to HtmlOutputRendererHelper, we ended up not using the parser
cache when loading VE. This caused load times to go up by more than a
second on average on the wiki where we enabled direct mode for VE
(hewiki).

Change-Id: I8d483971fd116e74e5e0923afce0abfd1402ae10
This commit is contained in:
daniel 2022-12-14 18:20:38 +01:00 committed by Daniel Kinzler
parent fe091a7cad
commit abec307409

View file

@ -30,7 +30,6 @@ use MediaWiki\Edit\SelserContext;
use MediaWiki\Languages\LanguageFactory;
use MediaWiki\MainConfigNames;
use MediaWiki\Page\PageIdentity;
use MediaWiki\Page\PageRecord;
use MediaWiki\Parser\Parsoid\HtmlTransformFactory;
use MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter;
use MediaWiki\Parser\Parsoid\ParsoidOutputAccess;
@ -526,9 +525,8 @@ class HtmlOutputRendererHelper {
// If we have a revision and the ID is 0 or null, then it's a fake revision
// representing a preview.
$isFakeRevision = $this->getRevisionId() === null;
$pageRecordAvailable = $this->page instanceof PageRecord;
if ( $pageRecordAvailable && !$isFakeRevision && !$parsoidOptions && $this->isCacheable ) {
if ( !$isFakeRevision && !$parsoidOptions && $this->isCacheable ) {
// Always log lint info when generating cacheable output.
// We are not really interested in lint data for old revisions, but
// we don't have a good way to tell at this point.