Change RevObject dispose() semantics to avoid reparses
commitc6fedc30ab0b7e1d7ff7aa012fe764c5a0631577
authorShawn O. Pearce <spearce@spearce.org>
Fri, 12 Jun 2009 23:00:18 +0000 (12 16:00 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sun, 14 Jun 2009 20:41:31 +0000 (14 22:41 +0200)
tree49e7cb2df86b087bf359cf8770fe37b39e2ecf16
parentcb9ef5943f74c662d2903392a8f7db70092e923c
Change RevObject dispose() semantics to avoid reparses

UploadPack was suffering from performance problems because dispose()
was unsetting the PARSED flag, causing another visit to a commit to
reparse the object from disk, even though we already had its parents
in memory.  If a client was 50,000 commits ahead of the server,
then the client could send 50,000 have requests, each time the
server is executing a full reparse of its own commit graph trying
to determine if the common set is sufficient yet.

Instead of asking applications to dispose of commit buffers when the
commit is popped out of the RevWalk we now dispose of the buffer as
soon as the headers are parsed.  For applications that never need
the buffer but have to process a lot of commits in the pending queue,
this can reduce memory usage by a fair amount, as the pending queue
no longer has to retain the buffers until the commits are returned
to the application for buffer disposal.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
13 files changed:
org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevWalkTestCase.java
org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/BoundaryGenerator.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/MergeBaseGenerator.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/ObjectWalk.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/PendingGenerator.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/RevCommit.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/RevObject.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/RevWalk.java
org.spearce.jgit/src/org/spearce/jgit/revwalk/RewriteTreeFilter.java
org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java
org.spearce.jgit/src/org/spearce/jgit/transport/WalkFetchConnection.java