Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/FileUtils.java @ 624:507602cb4fb3
FIXMEs and TODOs: pay some technical debt
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Mon, 20 May 2013 20:34:33 +0200 |
| parents | 868b2ffdcd5c |
| children | ffce73efa2c2 |
comparison
equal
deleted
inserted
replaced
| 623:fedc54356091 | 624:507602cb4fb3 |
|---|---|
| 80 closeQuietly(fis); | 80 closeQuietly(fis); |
| 81 closeQuietly(fos); | 81 closeQuietly(fos); |
| 82 String m = String.format("Failed to copy %s to %s", from.getName(), to.getName()); | 82 String m = String.format("Failed to copy %s to %s", from.getName(), to.getName()); |
| 83 throw new HgIOException(m, ex, from); | 83 throw new HgIOException(m, ex, from); |
| 84 } | 84 } |
| 85 /* Copy of cpython's 00changelog.d, 20Mb+ | |
| 86 * Linux&Windows: 300-400 ms, | |
| 87 * Windows uncached run: 1.6 seconds | |
| 88 */ | |
| 85 } | 89 } |
| 86 | 90 |
| 87 public void closeQuietly(Closeable stream) { | 91 public void closeQuietly(Closeable stream) { |
| 88 if (stream != null) { | 92 if (stream != null) { |
| 89 try { | 93 try { |
| 92 // ignore | 96 // ignore |
| 93 log.dump(getClass(), Severity.Warn, ex, "Exception while closing stream quietly"); | 97 log.dump(getClass(), Severity.Warn, ex, "Exception while closing stream quietly"); |
| 94 } | 98 } |
| 95 } | 99 } |
| 96 } | 100 } |
| 97 | |
| 98 public static void main(String[] args) throws Exception { | |
| 99 final long start = System.nanoTime(); | |
| 100 final File src = new File(".../hg/cpython/.hg/store/00changelog.d"); | |
| 101 copyFile(src, new File("/tmp/zxczxczxc234")); | |
| 102 final long end = System.nanoTime(); | |
| 103 System.out.printf("Copy of %,d bytes took %d ms", src.length(), (end-start)/1000000); | |
| 104 } | |
| 105 } | 101 } |
