AbstractChangeNotes: Lazily create RevWalk

In the common case where there is a ChangeNotesCache hit, we only need
the meta ID from the LoadHandle and not the RevWalk.

Creating RevWalks is cheap, but it's not free. For example, it creates
an ObjectIdOwnerMap which allocates two object arrays of size 1024 and
2048, totaling several KiB. A loaded server may have hundreds of
ChangeNotesCache hits per second, adding up to megabytes per second of
completely unused garbage. This isn't just theoretical: I observed
megabytes of garbage being generated by this path in a live frontend.

Change-Id: I583a3f5cac8b7be4832d49cf8cbdea54b1b3bf8e
This commit is contained in:
Dave Borowitz
2019-01-04 11:10:46 -08:00
parent deb7e4d61f
commit f995dbbda0
3 changed files with 32 additions and 21 deletions

View File

@@ -508,7 +508,7 @@ public class ChangeNotes extends AbstractChangeNotes<ChangeNotes> {
}
ChangeNotesCache.Value v =
args.cache.get().get(getProjectName(), getChangeId(), rev, handle.walk());
args.cache.get().get(getProjectName(), getChangeId(), rev, handle::walk);
state = v.state();
state.copyColumnsTo(change);
revisionNoteMap = v.revisionNoteMap();