Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/MapTagsToFileRevisions.java @ 268:c5980f287cc4
Use StringProxy when parsing manifest to minimize number of useless conversions and array instances
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 23 Aug 2011 22:30:56 +0200 |
parents | 31f67be94e71 |
children | 6dbbc53fc46d |
comparison
equal
deleted
inserted
replaced
267:ec921ef0628e | 268:c5980f287cc4 |
---|---|
64 System.out.printf("Total time: %d ms\n", System.currentTimeMillis() - start); | 64 System.out.printf("Total time: %d ms\n", System.currentTimeMillis() - start); |
65 System.out.printf("Free mem: %,d\n", Runtime.getRuntime().freeMemory()); | 65 System.out.printf("Free mem: %,d\n", Runtime.getRuntime().freeMemory()); |
66 } | 66 } |
67 | 67 |
68 private void manifestWalk() throws Exception { | 68 private void manifestWalk() throws Exception { |
69 System.out.println(System.getProperty("java.version")); | |
69 final long start = System.currentTimeMillis(); | 70 final long start = System.currentTimeMillis(); |
70 final HgRepository repository = new HgLookup().detect(new File("/temp/hg/cpython")); | 71 final HgRepository repository = new HgLookup().detect(new File("/temp/hg/cpython")); |
71 repository.getManifest().walk(0, 10000, new HgManifest.Inspector() { | 72 repository.getManifest().walk(0, 10000, new HgManifest.Inspector() { |
72 | 73 |
73 public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) { | 74 public boolean begin(int mainfestRevision, Nodeid nid, int changelogRevision) { |
85 // cpython: 1,1 sec for 0..1000, 43 sec for 0..10000, 115 sec for 0..20000 (Pool with HashMap) | 86 // cpython: 1,1 sec for 0..1000, 43 sec for 0..10000, 115 sec for 0..20000 (Pool with HashMap) |
86 // 2,4 sec for 1000..2000 | 87 // 2,4 sec for 1000..2000 |
87 // cpython -r 1000: 484 files, -r 2000: 1015 files. Iteration 1000..2000; fnamePool.size:1019 nodeidPool.size:2989 | 88 // cpython -r 1000: 484 files, -r 2000: 1015 files. Iteration 1000..2000; fnamePool.size:1019 nodeidPool.size:2989 |
88 // nodeidPool for two subsequent revisions only: 840. 37 sec for 0..10000. 99 sec for 0..20k | 89 // nodeidPool for two subsequent revisions only: 840. 37 sec for 0..10000. 99 sec for 0..20k |
89 // 0..10000 fnamePool: hits:15989152, misses:3020 | 90 // 0..10000 fnamePool: hits:15989152, misses:3020 |
91 // | |
92 // With Pool<StringProxy> for fname and flags, Nodeid's ascii2bin through local array, overall byte[] iteration, | |
93 // 0..10k is 34 seconds now | |
90 System.out.printf("Total time: %d ms\n", System.currentTimeMillis() - start); | 94 System.out.printf("Total time: %d ms\n", System.currentTimeMillis() - start); |
91 System.out.printf("Free mem: %,d\n", Runtime.getRuntime().freeMemory()); | 95 System.out.printf("Free mem: %,d\n", Runtime.getRuntime().freeMemory()); |
92 } | 96 } |
93 | 97 |
94 private void collectTagsPerFile() throws HgException, CancelledException { | 98 private void collectTagsPerFile() throws HgException, CancelledException { |