@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+19 -11
+1 -1
src/aphront/console/plugin/DarkConsoleXHProfPlugin.php
··· 87 87 'target' => '_blank', 88 88 ), 89 89 pht('Profile Permalink')); 90 - $result = phutil_tag( 90 + $result[] = phutil_tag( 91 91 'iframe', 92 92 array('src' => "/xhprof/profile/$run/?frame=true")); 93 93 } else {
+13 -6
src/infrastructure/markup/PhabricatorMarkupEngine.php
··· 202 202 PhabricatorMarkupInterface $object, 203 203 $field) { 204 204 205 - $custom = array_merge( 206 - self::loadCustomInlineRules(), 207 - self::loadCustomBlockRules()); 205 + static $custom; 206 + if ($custom === null) { 207 + $custom = array_merge( 208 + self::loadCustomInlineRules(), 209 + self::loadCustomBlockRules()); 208 210 209 - $custom = mpull($custom, 'getRuleVersion', null); 210 - ksort($custom); 211 - $custom = PhabricatorHash::digestForIndex(serialize($custom)); 211 + $custom = mpull($custom, 'getRuleVersion', null); 212 + ksort($custom); 213 + $custom = PhabricatorHash::digestForIndex(serialize($custom)); 214 + } 212 215 213 216 return $object->getMarkupFieldKey($field).'@'.$this->version.'@'.$custom; 214 217 } ··· 363 366 switch ($ruleset) { 364 367 case 'default': 365 368 $engine = self::newMarkupEngine(array()); 369 + break; 370 + case 'nolinebreaks': 371 + $engine = self::newMarkupEngine(array()); 372 + $engine->setConfig('preserve-linebreaks', false); 366 373 break; 367 374 case 'diviner': 368 375 $engine = self::newMarkupEngine(array());
+5 -4
src/infrastructure/markup/PhabricatorMarkupOneOff.php
··· 36 36 } 37 37 38 38 public function newMarkupEngine($field) { 39 - return PhabricatorMarkupEngine::newMarkupEngine( 40 - array( 41 - 'preserve-linebreaks' => $this->preserveLinebreaks, 42 - )); 39 + if ($this->preserveLinebreaks) { 40 + return PhabricatorMarkupEngine::getEngine(); 41 + } else { 42 + return PhabricatorMarkupEngine::getEngine('nolinebreaks'); 43 + } 43 44 } 44 45 45 46 public function getMarkupText($field) {