Commit c666cb9f authored by epriestley's avatar epriestley
Browse files

Reduce the frequency of DOM scans to rebuild inlines when scrolling revisions

Summary:
Ref T13513. See PHI1734, which raises a concern about the performance of large revisions near the 100-change threshold.

Currently, `getInlines()` is called whenever the scroll position transitions between two changesets, and it performs a relatively complicated DOM scan to lift inlines out of the document.

This shows up as taking a small but nontrivial amount of time in Firefox profiles and should be safely memoizable.

Test Plan:
  - Under Firefox profiling, scrolled through a large revision.
  - Before change: `getInlines()` appeared as the highest-cost thing we're explicitly doing on profiles.
  - After change: `getInlines()` was no longer meaningfully represented on profiles.
  - Created inlines, edited inlines, etc. Didn't identify any broken behavior.

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21261
parent b1351d0f
......@@ -13,7 +13,7 @@ return array(
'core.pkg.js' => '845355f4',
'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => '319dca29',
'differential.pkg.js' => '695827fc',
'differential.pkg.js' => 'bb2a17fc',
'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => 'a98c0bf7',
'maniphest.pkg.css' => '35995d6d',
......@@ -379,7 +379,7 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => 'a2ab19be',
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
'rsrc/js/application/diff/DiffChangeset.js' => 'bfdae878',
'rsrc/js/application/diff/DiffChangeset.js' => 'e02670b5',
'rsrc/js/application/diff/DiffChangesetList.js' => 'b1b8500b',
'rsrc/js/application/diff/DiffInline.js' => 'b00168c1',
'rsrc/js/application/diff/DiffPathView.js' => '8207abf9',
......@@ -774,7 +774,7 @@ return array(
'phabricator-darklog' => '3b869402',
'phabricator-darkmessage' => '26cd4b73',
'phabricator-dashboard-css' => '5a205b9d',
'phabricator-diff-changeset' => 'bfdae878',
'phabricator-diff-changeset' => 'e02670b5',
'phabricator-diff-changeset-list' => 'b1b8500b',
'phabricator-diff-inline' => 'b00168c1',
'phabricator-diff-path-view' => '8207abf9',
......@@ -2019,19 +2019,6 @@ return array(
'bcec20f0' => array(
'phui-theme-css',
),
'bfdae878' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
'phabricator-diff-path-view',
'phuix-button-view',
),
'c03f2fb4' => array(
'javelin-install',
),
......@@ -2124,6 +2111,19 @@ return array(
'df3afa61' => array(
'phui-inline-comment-view-css',
),
'e02670b5' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
'phabricator-diff-path-view',
'phuix-button-view',
),
'e150bd50' => array(
'javelin-behavior',
'javelin-stratcom',
......
......@@ -817,11 +817,18 @@ JX.install('DiffChangeset', {
},
getInlines: function() {
this._rebuildAllInlines();
if (this._inlines === null) {
this._rebuildAllInlines();
}
return this._inlines;
},
_rebuildAllInlines: function() {
if (this._inlines === null) {
this._inlines = [];
}
var rows = JX.DOM.scry(this._node, 'tr');
var ii;
for (ii = 0; ii < rows.length; ii++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment