mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-17 18:21:11 +01:00
Improve remarkup performance (Phabricator)
Summary: As we've moved more remarkup logic post-cache (e.g., to implement policy-aware rules), we're paying more of a price for it. Improve performance in Phabricator by sharing engine instances where possible. Test Plan: With next diff, this drops 75% of the cost of markup handling in Conpherence. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D5510
This commit is contained in:
parent
cd07182e9c
commit
7b07f6ab3d
2 changed files with 22 additions and 1 deletions
|
@ -61,7 +61,7 @@ abstract class PhabricatorApplicationTransactionComment
|
||||||
|
|
||||||
|
|
||||||
public function newMarkupEngine($field) {
|
public function newMarkupEngine($field) {
|
||||||
return PhabricatorMarkupEngine::newMarkupEngine(array());
|
return PhabricatorMarkupEngine::getEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -337,6 +337,27 @@ final class PhabricatorMarkupEngine {
|
||||||
return self::newMarkupEngine($options);
|
return self::newMarkupEngine($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @task engine
|
||||||
|
*/
|
||||||
|
public static function getEngine($ruleset = 'default') {
|
||||||
|
static $engines = array();
|
||||||
|
if (isset($engines[$ruleset])) {
|
||||||
|
return $engines[$ruleset];
|
||||||
|
}
|
||||||
|
|
||||||
|
$engine = null;
|
||||||
|
switch ($ruleset) {
|
||||||
|
case 'default':
|
||||||
|
$engine = self::newMarkupEngine(array());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Unknown engine ruleset: {$ruleset}!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$engines[$ruleset] = $engine;
|
||||||
|
return $engine;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @task engine
|
* @task engine
|
||||||
|
|
Loading…
Reference in a new issue