]> source.dussan.org Git - jgit.git/commit
SHA1: support reset() and reuse instances 72/91872/5
authorShawn Pearce <spearce@spearce.org>
Sun, 26 Feb 2017 19:44:51 +0000 (11:44 -0800)
committerJonathan Nieder <jrn@google.com>
Sun, 26 Feb 2017 23:26:53 +0000 (15:26 -0800)
commit1bf7d3f290ef7dbf9b4f12d15308a4d93042ac83
treedcd13a57b6323daf99673f41174cceac36d7b357
parent0f25f64d4882f7853c9d3dc84ec382d8a78ae646
SHA1: support reset() and reuse instances

Allow SHA1 instances to be reused to compute another hash value, and
resume caching them in ObjectInserter and PackParser.  This shaves a
small amount of running time off parsing git.git's pack file:

  before   after
  ------   ------
  25.25s   25.55s
  25.48s   25.06s
  25.26s   24.94s

Almost noise (small difference), but recycling the instances reduces
some stress on the memory allocator finding two 80 word message block
arrays needed for hashing and collision detection.

Change-Id: I4af88a720e81460293bc5c5d1d3db1a831e7e228
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/sha1/SHA1Test.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/SHA1.java