]> source.dussan.org Git - jgit.git/commit
Tighten up local packed object representation during packing 71/971/1
authorShawn O. Pearce <spearce@spearce.org>
Sun, 27 Jun 2010 00:37:16 +0000 (17:37 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 27 Jun 2010 01:50:38 +0000 (18:50 -0700)
commit86547022f02b8e37bb88c8501f1c8c9e59d3b647
treeb215145fd56decf99000981392dcb0767a0a7dd3
parentad5238dc67aa5922c425e6bc829e1152c2e20439
Tighten up local packed object representation during packing

Rather than making a loader, and then using that to fill the object
representation, parse the header and set up our data directly.
This saves some time, as we don't waste cycles on information we
won't use right now.

The weight computed for a representation is now its actual stored
size in the pack file, rather than its inflated size.  This accounts
for changes made when the compression level is modified on the
repository.  It is however more costly to determine the weight of
the object, since we have to find its length in the pack.  To try and
recover that cost we now cache the length as part of our ObjectToPack
record, so it doesn't have to be found during the output phase.

A LocalObjectToPack now costs us (assuming 32 bit pointers):

                   (32 bit)     (64 bit)
  vm header:         8 bytes      8 bytes
  ObjectId:         20 bytes     20 bytes
  PackedObjectInfo: 12 bytes     12 bytes
  ObjectToPack:      8 bytes     12 bytes
  LocalOTP:         20 bytes     24 bytes
                 -----------    ---------
                    68 bytes     74 bytes

Change-Id: I923d2736186eb2ac8ab498d3eb137e17930fcb50
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalObjectRepresentation.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalObjectToPack.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectory.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/file/WindowCursor.java