From ba9b4f5b66c223f5cd9013cfda53835049e4fb71 Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 15 Jun 2012 14:56:03 -0700 Subject: [PATCH] Optimize SQL queries in differential.getdiff Test Plan: Verified that the method retuns the same output. Verified the number of SQL queries. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D2764 --- .../ConduitAPI_differential_getdiff_Method.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/applications/conduit/method/differential/ConduitAPI_differential_getdiff_Method.php b/src/applications/conduit/method/differential/ConduitAPI_differential_getdiff_Method.php index 3a72c8efb9..9f8920951a 100644 --- a/src/applications/conduit/method/differential/ConduitAPI_differential_getdiff_Method.php +++ b/src/applications/conduit/method/differential/ConduitAPI_differential_getdiff_Method.php @@ -70,10 +70,11 @@ final class ConduitAPI_differential_getdiff_Method extends ConduitAPIMethod { throw new ConduitException('ERR_BAD_DIFF'); } - $diff->attachChangesets($diff->loadChangesets()); - // TODO: We could batch this to improve performance. + $diff->attachChangesets( + $diff->loadRelatives(new DifferentialChangeset(), 'diffID')); foreach ($diff->getChangesets() as $changeset) { - $changeset->attachHunks($changeset->loadHunks()); + $changeset->attachHunks( + $changeset->loadRelatives(new DifferentialHunk(), 'changesetID')); } $basic_dict = $diff->getDiffDict();