1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 01:10:58 +01:00

Conpherence - use some handle pools for Durable column perf

Summary:
Ref T7708.

This changes things to $viewer->loadHandles where applicable in the durable column render stack. I saw some big wins on my test data like 34 queries => 24 queries on a newly created room as my default thread.

For my test data, the next big perf win would be to change how remarkup rendering works and try to multiload all objects of a certain type in one shot.
e.g. `PhabricatorEmbedFileRemarkupRule` implements `loadObjects` as do all classes which inherit from `PhabricatorObjectRemarkupRule`. This is because `PhabricatorObjectRemarkupRule` implements its `didMarkupText` method using `loadObjects`, and `didMarkupText` gets called per transaction over in `PhabricatorMarkupEngine->process()`. Instead, the `loadObjects` in `didMarkupText` should be hitting some cache, and we should do a bulk load for all `PhabricatorEmbedFileRemarkupRule` that had matches earlier in the rendering stack.  ...I think.

Test Plan: carefully looked at "Services" tab in dark console and noted fewer queries with changes post changes versus pre changes

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7708

Differential Revision: https://secure.phabricator.com/D12780
This commit is contained in:
Bob Trahan 2015-05-08 18:14:04 -07:00
parent dd8e4ff056
commit 99b4941c9a
3 changed files with 8 additions and 12 deletions

View file

@ -285,10 +285,9 @@ final class ConpherenceThreadQuery
$conpherence->$method(); $conpherence->$method();
} }
$flat_phids = array_mergev($handle_phids); $flat_phids = array_mergev($handle_phids);
$handles = id(new PhabricatorHandleQuery()) $viewer = $this->getViewer();
->setViewer($this->getViewer()) $handles = $viewer->loadHandles($flat_phids);
->withPHIDs($flat_phids) $handles = iterator_to_array($handles);
->execute();
foreach ($handle_phids as $conpherence_phid => $phids) { foreach ($handle_phids as $conpherence_phid => $phids) {
$conpherence = $conpherences[$conpherence_phid]; $conpherence = $conpherences[$conpherence_phid];
$conpherence->attachHandles( $conpherence->attachHandles(

View file

@ -126,10 +126,8 @@ abstract class PhabricatorApplicationTransactionQuery
$handles = array(); $handles = array();
$merged = array_mergev($phids); $merged = array_mergev($phids);
if ($merged) { if ($merged) {
$handles = id(new PhabricatorHandleQuery()) $handles = $this->getViewer()->loadHandles($merged);
->setViewer($this->getViewer()) $handles = iterator_to_array($handles);
->withPHIDs($merged)
->execute();
} }
foreach ($xactions as $xaction) { foreach ($xactions as $xaction) {
$xaction->setHandles( $xaction->setHandles(

View file

@ -28,10 +28,9 @@ abstract class PhabricatorObjectRemarkupRule extends PhutilRemarkupRule {
protected function loadHandles(array $objects) { protected function loadHandles(array $objects) {
$phids = mpull($objects, 'getPHID'); $phids = mpull($objects, 'getPHID');
$handles = id(new PhabricatorHandleQuery($phids)) $viewer = $this->getEngine()->getConfig('viewer');
->withPHIDs($phids) $handles = $viewer->loadHandles($phids);
->setViewer($this->getEngine()->getConfig('viewer')) $handles = iterator_to_array($handles);
->execute();
$result = array(); $result = array();
foreach ($objects as $id => $object) { foreach ($objects as $id => $object) {