Replace inefficient new Long(long) constructor to silence FindBugs
commitb16aa00a9ef8c3f6bfcdc514a85e99ba096efd77
authorShawn O. Pearce <spearce@spearce.org>
Wed, 29 Apr 2009 18:54:41 +0000 (29 11:54 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 29 Apr 2009 23:49:06 +0000 (30 01:49 +0200)
tree70ffe021806ee9022942785f53e42ce7e28feed9
parent01402cdcb9b1f19c6603ec226b63ebdb270d3995
Replace inefficient new Long(long) constructor to silence FindBugs

FindBugs keeps warning us that new Long(long) is inefficient because
it doesn't permit using cached values in the -128..127 range.

We now use a custom Map implementation which supports primitive long
as the hash key, rather than requiring boxing for java.util.HashMap.
This removes the issue FindBugs was identifying.

This version performs slightly better than before.
index-pack on linux-2.6:

  parent commit:  2m58.611s
  this commit  :  2m57.068s

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Yann Simon <yann.simon.fr@gmail.com>
CC: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit.test/tst/org/spearce/jgit/transport/LongMapTest.java [new file with mode: 0644]
org.spearce.jgit/src/org/spearce/jgit/transport/IndexPack.java
org.spearce.jgit/src/org/spearce/jgit/transport/LongMap.java [new file with mode: 0644]