diff options
author | Shawn Pearce <spearce@spearce.org> | 2015-11-28 08:58:15 -0800 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2015-11-28 09:01:03 -0800 |
commit | 761814fe9c3fc0503d4654ef4aace6a804da5ae7 (patch) | |
tree | e508cc1b119e4f3d10c6bc4897e1be494edf2a7c /org.eclipse.jgit.test | |
parent | 885879ffe907a5df1c6fcc40ef6972e27dfecdd6 (diff) | |
download | jgit-761814fe9c3fc0503d4654ef4aace6a804da5ae7.tar.gz jgit-761814fe9c3fc0503d4654ef4aace6a804da5ae7.zip |
DirCacheEntry: Speed up creation by avoiding string cast
The checkPath function is available as a byte[] form, in fact the
String form just converts to byte[] to run the algorithm.
Having DirCacheEntry take a byte[] -> String -> byte[] to check if
each path is valid is a huge waste of CPU time. On some systems it
can double the time required to read 38,999 files from trees to the
DirCache. This slows down any operation using a DirCache.
Expose the byte[] form and use it for DirCacheEntry creation.
Change-Id: I6db7bc793ece99ff3c356338d793c07c061aeac7
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java index e159ed939e..dc7181aece 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java @@ -69,9 +69,9 @@ public class DirCacheEntryTest { assertFalse(isValidPath("a\u0000b")); } - private static boolean isValidPath(final String path) { + private static boolean isValidPath(String path) { try { - DirCacheCheckout.checkValidPath(path); + new DirCacheEntry(path); return true; } catch (InvalidPathException e) { return false; |