Speed up loading and rendering of diffs.

Review Request #8892 — Created April 10, 2017 and submitted

Information

Review Board
release-2.5.x
d6630be...

Reviewers

When working with large diffs, there's slowdown when injecting the HTML
for the diff and setting it up. As part of the setup, we make some CSS
changes to elements in the rendered diff, and if the browser is bogged
down rendering a large diff, this can just slow things down further.

To deal with this, we now hide the parent of the rendered diff and then
manually inject the HTML using the innerHTML attribute, instead of going
through jQuery (which is going to be slower for this operation, in our
case), re-showing the element when we're finished the render. This
speeds up diff load times a fair amount.

Loaded several diffs, small and large. Timed performance and saw
noticeable improvements with large diffs.

Description From Last Updated

Can you include a comment explaining why we're avoiding using jquery to attach the HTML?

daviddavid

This doesn't seem like it's really meant to be part of this change.

daviddavid
brennie
  1. Ship It!
  2. 
      
david
  1. 
      
  2. Can you include a comment explaining why we're avoiding using jquery to attach the HTML?

  3. 
      
chipx86
david
  1. 
      
  2. This doesn't seem like it's really meant to be part of this change.

    1. I'll add a comment, but this is actually intended. What's happening is that we need a width, and we can't get it from the parent itself, since it's hidden (to speed up loading/rendering -- the point of this change). We'll just get 0. The grand-parent, however, is not hidden, and is a good basis for the width. So we grab that instead.

      I'm going to change this to check visibility on the parent, and use the grandparent if hidden, along with a comment explaining this.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.5.x (6d38447)
Loading...