Reduce the work needed to return a rendered diff.

Review Request #7120 — Created March 25, 2015 and submitted

Information

Review Board
release-2.0.x
cfa592e...

Reviewers

The diff viewer was always a little more sluggish than I liked. Part of
this was due to some issues fixed in a recent change involving cache
keys and browser caching, but even with that, we were performing some
expensive operations way before we needed to.

When preparing to render a diff for a file, we generated information
about the file being generated to feed to the DiffRenderer. This
included the chunks (even if we were just fetching from cache). The
DiffRenderer then operated on some of this information in the
constructor. This all happened before we even dealt with determining if
there was a rendered diff already in the cache.

These operations now happen a lot later. We do as little as possible
when asked to render a diff, until we know we're going to actually begin
rendering it from scratch. Only at that point do we request the chunks
from the diff.

This reduces the amount of time for a request considerably. Combined
with the improved caching, it makes expanding a diff nearly
instantaneous, as makes loads for all users (after the first diff
render) very fast.

Browsed a few diffs, with/without server caching primed and with/without
browser caching primed.

Saw some pretty good speed improvements all throughout, particularly once
a diff has been rendered before.

Tested viewing diffs and expanding/collapsing diffs in various areas.

Description From Last Updated

'populate_diff_chunks' imported but unused

reviewbotreviewbot
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/renderers.py
        reviewboard/diffviewer/views.py
        reviewboard/diffviewer/diffutils.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/renderers.py
        reviewboard/diffviewer/views.py
        reviewboard/diffviewer/diffutils.py
    
    
  2. reviewboard/diffviewer/views.py (Diff revision 1)
     
     
    Show all issues
     'populate_diff_chunks' imported but unused
    
  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/renderers.py
        reviewboard/diffviewer/views.py
        reviewboard/diffviewer/diffutils.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/renderers.py
        reviewboard/diffviewer/views.py
        reviewboard/diffviewer/diffutils.py
    
    
  2. 
      
brennie
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (6640889)
Loading...