1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 23:40:57 +01:00

Speed up DiffusionBrowseFileController by removing call to array_merge

Summary: Some profiling using XHProf in the Dark Console showed me that Diffusion was wasting a ton of time on array_merge. This change sped up the loading of a large file in Diffusion from 16.8 seconds to 2.4 seconds.

Test Plan: Load files in Diffusion. They all look good. Also, use a PHP shell to try to manually verify that I still kinda remember some PHP and, yes, this is functionally equivalent to what was there before.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9032
This commit is contained in:
Jacob Hurwitz 2014-05-09 18:06:29 -07:00 committed by epriestley
parent e96c363eef
commit 9d0d1ac42f

View file

@ -800,10 +800,13 @@ final class DiffusionBrowseFileController extends DiffusionBrowseController {
),
$blame);
$rows = array_merge($rows, $this->renderInlines(
$cur_inlines = $this->renderInlines(
idx($inlines, $line['line'], array()),
($show_blame),
$engine));
$engine);
foreach ($cur_inlines as $cur_inline) {
$rows[] = $cur_inline;
}
}
return $rows;