diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-06-26 15:17:09 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-06-26 16:13:22 -0700 |
commit | 3a7aec03e07ac853df5a00cbf06e6cd5e4ba2bc2 (patch) | |
tree | 30a238a321c3aa616ed00cb05f3ea7690fd16a25 /org.eclipse.jgit.http.test | |
parent | ece88b99eb2ea6541b667aa066573184c25b6a8b (diff) | |
download | jgit-3a7aec03e07ac853df5a00cbf06e6cd5e4ba2bc2.tar.gz jgit-3a7aec03e07ac853df5a00cbf06e6cd5e4ba2bc2.zip |
Implement zero-copy for single window objects
Objects that fall completely within a single window can be worked
with in a zero-copy fashion, provided that the window is backed by
a normal byte[] and not by a ByteBuffer.
This works for a surprising number of objects. The default window
size is 8 KiB, but most deltas are quite a bit smaller than that.
Objects smaller than 1/2 of the window size have a very good chance
of falling completely within a window's array, which means we can
work with them without copying their data around.
Larger objects, or objects which are unlucky enough to span over a
window boundary, get copied through the temporary buffer. We pay
a tiny penalty to realize we can't use the zero-copy code path,
but its easier than trying to keep track of two adjacent windows.
With this change (as well as everything preceeding it), packing
is actually a bit faster. Some crude benchmarks based on cloning
linux-2.6.git (~324 MiB, 1,624,785 objects) over localhost using
C git client and JGit daemon shows we get better throughput, and
slightly better times:
Total Time | Throughput
(old) (now) | (old) (now)
--------------+---------------------------
2m45s 2m37s | 12.49 MiB/s 21.17 MiB/s
2m42s 2m36s | 16.29 MiB/s 22.63 MiB/s
2m37s 2m31s | 16.07 MiB/s 21.92 MiB/s
Change-Id: I48b2c8d37f08d7bf5e76c5a8020cde4a16ae3396
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.http.test')
0 files changed, 0 insertions, 0 deletions