@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix performance issue with large changesets in Differential

Summary:
Fixes T3151. Javelin treats a behavior without parameters as a global behavior and invokes it only once no matter how many times it is initialized (this is necessarily correct for any reasonable behavior, as the inputs do not vary). A recent patch changed `differential-dropdown-menus` from a zero-argument global behavior to an implicitly nonzero-argument behavior by adding `pht`.

Currently, we initialize the behavior next to dropdown menu creation, so this resulted in `O(N^2)` initializations of the menus. For large diffs, this locks browsers. Instead, initialize outside of the dropdown loop so we ginitialize each menu just once.

Test Plan: Viewed a 2,000 file diff without browser lock.

Reviewers: wez, vrana, btrahan

Reviewed By: wez

CC: aran

Maniphest Tasks: T3151

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

+3 -4
+3 -4
src/applications/differential/view/DifferentialChangesetListView.php
··· 108 108 $changesets = $this->changesets; 109 109 110 110 Javelin::initBehavior('differential-toggle-files', array()); 111 + Javelin::initBehavior( 112 + 'differential-dropdown-menus', 113 + array()); 111 114 112 115 $output = array(); 113 116 $mapping = array(); ··· 303 306 } 304 307 305 308 $meta['containerID'] = $detail->getID(); 306 - 307 - Javelin::initBehavior( 308 - 'differential-dropdown-menus', 309 - array()); 310 309 311 310 return javelin_tag( 312 311 'a',