]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Minor performance optimization
authorJoshua Spence <josh@joshuaspence.com>
Wed, 8 Jul 2015 08:32:08 +0000 (18:32 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Wed, 8 Jul 2015 08:32:08 +0000 (18:32 +1000)
Summary: Avoid using `idx` in `PhutilTestCase::endCoverage`.

Test Plan: Compared [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-tgmc6ci74daivtankuck/?symbol=idx | before]] and [[https://secure.phabricator.com/xhprof/profile/PHID-FILE-nd77mled6xnezyxidd6m/?symbol=idx | after]].

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13595

src/unit/engine/phutil/PhutilTestCase.php

index 902586bae9fb81da1ddeb2dcb1095ce1332cb299..911ebbc8aa7c68a149a9cd560ea5e3b03b3e9875 100644 (file)
@@ -582,7 +582,10 @@ abstract class PhutilTestCase extends Phobject {
       $max = max(array_keys($report));
       $str = '';
       for ($ii = 1; $ii <= $max; $ii++) {
-        $c = idx($report, $ii);
+        $c = null;
+        if (isset($report[$ii])) {
+          $c = $report[$ii];
+        }
         if ($c === -1) {
           $str .= 'U'; // Un-covered.
         } else if ($c === -2) {