Split intraline differences into their own cache
The bulk of the running time for loading a PatchList entry from the PatchListCache is actually within the intraline difference code. Assuming no bugs, running JGit's DiffFormatter and converting the results is typically sub-second, even for a very large change that has renames. By deferring the intraline difference logic until its actually required to display a particular file allows file lists to load very quickly, and doesn't penalize users who have disabled the intraline difference setting in their account preferences. This also offers a work around for the dreaded "patch of death" situation. When a bad file is encountered and it won't load, users can temporarily switch off intraline difference and open the file anyway. Unfortunately the server will still have at least one worker thread stuck generating the intraline difference cache record, but at least the change is still viewable. Change-Id: I61bbd3d068bd9b3da9d1018c0f66969a5b6ff58e Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -18,6 +18,11 @@ import com.google.gerrit.reviewdb.Change;
|
||||
import com.google.gerrit.reviewdb.PatchSet;
|
||||
import com.google.gerrit.reviewdb.AccountDiffPreference.Whitespace;
|
||||
|
||||
import org.eclipse.jgit.diff.Edit;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** Provides a cached list of {@link PatchListEntry}. */
|
||||
public interface PatchListCache {
|
||||
public PatchList get(PatchListKey key);
|
||||
@@ -25,4 +30,7 @@ public interface PatchListCache {
|
||||
public PatchList get(Change change, PatchSet patchSet);
|
||||
|
||||
public PatchList get(Change change, PatchSet patchSet, Whitespace whitespace);
|
||||
|
||||
public IntraLineDiff get(ObjectId aId, Text aText, ObjectId bId, Text bText,
|
||||
List<Edit> edits);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user