From 2bb7110759e2901be010987d31c087c62521d0bf Mon Sep 17 00:00:00 2001 From: Ole Rehmsen Date: Thu, 8 Nov 2018 09:24:46 +0100 Subject: [PATCH] Remove comment thread prerendering This should not be necessary anymore since all comments are "pre-rendered" in the gr-diff-host. I compared before and after with the Chrome profiler for the file [1] of the original report [2], and could not find a difference. [1] /c/chromiumos/third_party/coreboot/+/257398/25/src/soc/mediatek/mt8173/dramc_pi_calibration_api.c [2] https://bugs.chromium.org/p/gerrit/issues/detail?id=4335 Change-Id: If030867ddf0d7e8aba1252c06242965eca5c08c0 --- .../diff/gr-diff-builder/gr-diff-builder.html | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html index 33e2a19115..e26201af66 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html +++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.html @@ -156,10 +156,6 @@ limitations under the License. } this._layers = layers; - - this.async(() => { - this._preRenderThread(); - }); }, render(comments, prefs) { @@ -448,25 +444,6 @@ limitations under the License. }; }, - /** - * In pages with large diffs, creating the first comment thread can be - * slow because nested Polymer elements (particularly - * iron-autogrow-textarea) add style elements to the document head, - * which, in turn, triggers a reflow on the page. Create a hidden - * thread, attach it to the page, and remove it so the stylesheet will - * already exist and the user's comment will be quick to load. - * @see https://gerrit-review.googlesource.com/c/82213/ - */ - _preRenderThread() { - const thread = document.createElement('gr-diff-comment-thread'); - thread.setAttribute('hidden', true); - thread.addDraft(); - const parent = Polymer.dom(this.root); - parent.appendChild(thread); - Polymer.dom.flush(); - parent.removeChild(thread); - }, - /** * @return {boolean} whether any of the lines in _groups are longer * than SYNTAX_MAX_LINE_LENGTH.