1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 13:22:42 +01:00

Stop markup cache from hitting cache O(N^2) times

Summary:
The intent of getOrBuildEngine() is to save some boilerplate in cases where we're just using a standard engine, but it didn't get cached so we'd rebuilt it over and over again.

This was especially bad in Differential with a large number of inlines.

Test Plan: "Query" tab of services is no longer quite so ridiculous in Differential.

Reviewers: btrahan, dctrwatson

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D8352
This commit is contained in:
epriestley 2014-02-26 13:17:28 -08:00
parent 7f5b15c6fa
commit 7ff2110655
2 changed files with 14 additions and 17 deletions

View file

@ -903,9 +903,6 @@ final class DifferentialRevisionViewController extends DifferentialController {
->needComments(true)
->execute();
$engine = id(new PhabricatorMarkupEngine())
->setViewer($viewer);
$timeline = id(new DifferentialTransactionView())
->setUser($viewer)
->setObjectPHID($revision->getPHID())

View file

@ -149,23 +149,23 @@ class PhabricatorApplicationTransactionView extends AphrontView {
}
protected function getOrBuildEngine() {
if ($this->engine) {
return $this->engine;
}
if (!$this->engine) {
$field = PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT;
$field = PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT;
$engine = id(new PhabricatorMarkupEngine())
->setViewer($this->getUser());
foreach ($this->transactions as $xaction) {
if (!$xaction->hasComment()) {
continue;
$engine = id(new PhabricatorMarkupEngine())
->setViewer($this->getUser());
foreach ($this->transactions as $xaction) {
if (!$xaction->hasComment()) {
continue;
}
$engine->addObject($xaction->getComment(), $field);
}
$engine->addObject($xaction->getComment(), $field);
}
$engine->process();
$engine->process();
return $engine;
$this->engine = $engine;
}
return $this->engine;
}
private function buildChangeDetailsLink(