]> source.dussan.org Git - jgit.git/commit
Replace usage of ArrayIndexOutOfBoundsException in treewalk 32/155532/3
authorPatrick Hiesel <hiesel@google.com>
Thu, 9 Jan 2020 09:23:12 +0000 (10:23 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Thu, 9 Jan 2020 17:38:02 +0000 (18:38 +0100)
commit6185db3d776f1064af1972b4ba2175a917c35ab3
treeb639add2aeb235dd35db6135f49295bceec87f99
parent2b9dd32a828577bc1026ad53ec4f735a9b219022
Replace usage of ArrayIndexOutOfBoundsException in treewalk

Using exceptions during normal operations - for example with the
desire of expanding an array in the failure case - can have a
severe performance impact. When exceptions are instantiated,
a stack trace is collected. Generating stack trace can be expensive.

Compared to that, checking an array for length - even if done many
times - is cheap since this is a check that can run in just a
handful of CPU cycles.

Change-Id: Ifaf10623f6a876c9faecfa44654c9296315adfcb
Signed-off-by: Patrick Hiesel <hiesel@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java