mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Cache the computation of the custom block component of the markup key
Summary: Caught this taking way too long on a production profile: https://secure.phabricator.com/xhprof/profile/PHID-FILE-vfzq3sregh5xvpf5nc2t/?symbol=PhabricatorMarkupEngine::getMarkupFieldKey Cache it; it's always identical. Test Plan: Loaded Conpherence locally. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7583
This commit is contained in:
parent
87a655e8c5
commit
3b257381ad
3 changed files with 19 additions and 11 deletions
|
@ -87,7 +87,7 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin {
|
|||
'target' => '_blank',
|
||||
),
|
||||
pht('Profile Permalink'));
|
||||
$result = phutil_tag(
|
||||
$result[] = phutil_tag(
|
||||
'iframe',
|
||||
array('src' => "/xhprof/profile/$run/?frame=true"));
|
||||
} else {
|
||||
|
|
|
@ -202,13 +202,16 @@ final class PhabricatorMarkupEngine {
|
|||
PhabricatorMarkupInterface $object,
|
||||
$field) {
|
||||
|
||||
$custom = array_merge(
|
||||
self::loadCustomInlineRules(),
|
||||
self::loadCustomBlockRules());
|
||||
static $custom;
|
||||
if ($custom === null) {
|
||||
$custom = array_merge(
|
||||
self::loadCustomInlineRules(),
|
||||
self::loadCustomBlockRules());
|
||||
|
||||
$custom = mpull($custom, 'getRuleVersion', null);
|
||||
ksort($custom);
|
||||
$custom = PhabricatorHash::digestForIndex(serialize($custom));
|
||||
$custom = mpull($custom, 'getRuleVersion', null);
|
||||
ksort($custom);
|
||||
$custom = PhabricatorHash::digestForIndex(serialize($custom));
|
||||
}
|
||||
|
||||
return $object->getMarkupFieldKey($field).'@'.$this->version.'@'.$custom;
|
||||
}
|
||||
|
@ -364,6 +367,10 @@ final class PhabricatorMarkupEngine {
|
|||
case 'default':
|
||||
$engine = self::newMarkupEngine(array());
|
||||
break;
|
||||
case 'nolinebreaks':
|
||||
$engine = self::newMarkupEngine(array());
|
||||
$engine->setConfig('preserve-linebreaks', false);
|
||||
break;
|
||||
case 'diviner':
|
||||
$engine = self::newMarkupEngine(array());
|
||||
$engine->setConfig('preserve-linebreaks', false);
|
||||
|
|
|
@ -36,10 +36,11 @@ final class PhabricatorMarkupOneOff implements PhabricatorMarkupInterface {
|
|||
}
|
||||
|
||||
public function newMarkupEngine($field) {
|
||||
return PhabricatorMarkupEngine::newMarkupEngine(
|
||||
array(
|
||||
'preserve-linebreaks' => $this->preserveLinebreaks,
|
||||
));
|
||||
if ($this->preserveLinebreaks) {
|
||||
return PhabricatorMarkupEngine::getEngine();
|
||||
} else {
|
||||
return PhabricatorMarkupEngine::getEngine('nolinebreaks');
|
||||
}
|
||||
}
|
||||
|
||||
public function getMarkupText($field) {
|
||||
|
|
Loading…
Reference in a new issue