Cache diff file fragments

Review Request #104 — Created June 28, 2007 and submitted


Review Board SVN (deprecated)


We were spending a lot of time in each view_diff rebuilding the diffs.  Except for variations due to collapsing and syntax hilighting, these won't actually change.  Rendering these to strings and caching the results has resulted in my profile being mostly inside view_diff to being mostly inside django internals and locmem caching code.  Whoopee.
Looked at both collapsed and expanded versions of the diff.  Reloaded a bunch and looked at the profile data.
  1. Awesome. A few changes though.
  2. trunk/reviewboard/diffviewer/ (Diff revision 2)
    This can be simplified to:
    return render_to_string(template_name, RequestContext(request, context))
    You should then remove the import above to and add:
    from django.template.loader import render_to_string
  3. trunk/reviewboard/diffviewer/ (Diff revision 2)
    Should be "highlighting"
  4. trunk/reviewboard/diffviewer/ (Diff revision 2)
    No need for parens arond the file['filediff'].id.
  5. trunk/reviewboard/diffviewer/ (Diff revision 2)