Speed up loading and rendering of diffs.
Review Request #8892 — Created April 10, 2017 and submitted
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.
- Change Summary:
-
Added a comment around the diff HTML setting changes, explaining why we're using
innerHTML
directly. - Commit:
-
e6cec14677b34a20d6a650fa79565d15a66e42d2eea60ff3aa8262271f171e1cb6e11a53860fa820
Checks run (3 succeeded)
JSHint
passed.
PEP8 Style Checker
passed.
Pyflakes
passed.