Permalink
Browse files

Resolve diff property updates in parallel

Summary:
I was thinking about creating a method `differential.setdiffproperties` updating all properties at once or adding 'properties' to `differential.creatediff` (better) but it will require bumping Conduit version.

This looks simpler and with similar effect.
We could postpone resolving properties more but I don't want to risk not resolving them after an error.

Test Plan:
This diff for that it works.
Benchmark: 0.55 s before, 0.25 s after (with three properties, the difference will be bigger with more).

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3689
  • Loading branch information...
1 parent 646b37a commit 3d00e0448d2b47a89134a83f6c6509d278cbf2cb vrana committed Oct 12, 2012
Showing with 16 additions and 3 deletions.
  1. +16 −3 src/workflow/ArcanistDiffWorkflow.php
View
19 src/workflow/ArcanistDiffWorkflow.php
@@ -38,6 +38,7 @@
private $revisionID;
private $postponedLinters;
private $haveUncommittedChanges = false;
+ private $diffPropertyFutures = array();
public function getCommandSynopses() {
return phutil_console_format(<<<EOTEXT
@@ -459,6 +460,7 @@ public function run() {
$this->updateLintDiffProperty();
$this->updateUnitDiffProperty();
$this->updateLocalDiffProperty();
+ $this->resolveDiffPropertyUpdates();
$output_json = $this->getArgument('json');
@@ -499,10 +501,9 @@ public function run() {
$revision = $this->dispatchWillCreateRevisionEvent($revision);
- $future = $conduit->callMethod(
+ $result = $conduit->callMethodSynchronous(
'differential.createrevision',
$revision);
- $result = $future->resolve();
$revised_message = $conduit->callMethodSynchronous(
'differential.getcommitmessage',
@@ -2292,7 +2293,7 @@ private function updateLocalDiffProperty() {
* @task diffprop
*/
private function updateDiffProperty($name, $data) {
- $this->getConduit()->callMethodSynchronous(
+ $this->diffPropertyFutures[] = $this->getConduit()->callMethod(
'differential.setdiffproperty',
array(
'diff_id' => $this->getDiffID(),
@@ -2301,6 +2302,18 @@ private function updateDiffProperty($name, $data) {
));
}
+ /**
+ * Wait for finishing all diff property updates.
+ *
+ * @return void
+ *
+ * @task diffprop
+ */
+ private function resolveDiffPropertyUpdates() {
+ Futures($this->diffPropertyFutures)->resolveAll();
+ $this->diffPropertyFutures = array();
+ }
+
private function dispatchWillCreateRevisionEvent(array $fields) {
$event = $this->dispatchEvent(
ArcanistEventType::TYPE_REVISION_WILLCREATEREVISION,

0 comments on commit 3d00e04

Please sign in to comment.