]> source.dussan.org Git - jgit.git/commit
Reduce size of PackedObjectLoader by dropping long to int 09/709/1
authorShawn O. Pearce <spearce@spearce.org>
Sun, 16 May 2010 00:37:14 +0000 (17:37 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 16 May 2010 00:37:18 +0000 (17:37 -0700)
commitcb5bc195406aaead0de6fa563b4b8aaacb8d20b8
tree1530e315e73443da4d932ae997812f12fd1e1b71
parent9c4d42e94dbf199a9cef46a4b9286552c8633f4f
Reduce size of PackedObjectLoader by dropping long to int

Rather than keep track of both the position of the object, and the
position of its data, just keep track of the number of bytes used
by the object's header in the pack.  This shaves 4 bytes out of the
size of the PackedObjectLoader instances.

We also can defer the addition instruction to the materialize()
operation, avoiding it entirely if the caller never actually uses
the loader.  This may be relevant for PackWriter invocations,
where only 1 loader gets chosen for a given object, even though
the object may appear on disk in more than one pack file.

Error reporting is now simplified, as we can rely on the object
offset rather than its data offset.  This is the value displayed
by pack debugging tools like `git verify-pack -v`, so its better
to use that in our own errors.

Because nobody needs getDataOffset() now, we can drop that from
the public API.

Change-Id: Ic639c0d5a722315f4f5c8ffda6e26643d90e5f42
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0004_PackReader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaOfsPackedObjectLoader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaPackedObjectLoader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaRefPackedObjectLoader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/PackedObjectLoader.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/WholePackedObjectLoader.java