jgit/org.eclipse.jgit
Shawn O. Pearce 3a7aec03e0 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>
2010-06-26 16:13:22 -07:00
..
.settings Fix line endings 2010-06-18 23:36:18 +02:00
META-INF Redo event listeners to be more generic 2010-06-25 18:03:41 -07:00
findBugs Initial JGit contribution to eclipse.org 2009-09-29 16:47:03 -07:00
resources/org/eclipse/jgit Refactor repository construction to builder class 2010-06-25 17:58:40 -07:00
src/org/eclipse/jgit Implement zero-copy for single window objects 2010-06-26 16:13:22 -07:00
.classpath Externalize strings from JGit 2010-05-19 14:37:16 -07:00
.fbprefs Initial JGit contribution to eclipse.org 2009-09-29 16:47:03 -07:00
.gitignore Finish removing Apache Felix maven-bundle-plugin 2010-01-12 11:46:55 -08:00
.project Adding PDE API Tools nature to JGit 2010-01-16 10:00:30 -06:00
about.html Adding some Eclipse-related legal files to JGit 2010-02-03 15:18:06 -06:00
build.properties Add "resources/" as a source folder 2010-06-05 14:39:27 +02:00
plugin.properties Cleaning up provider and feature names 2010-04-27 09:26:25 -05:00
pom.xml Start 0.9 development 2010-06-14 08:11:27 -07:00