Mercurial > jhg
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 576:3c4db86e8c1f
Issue 43: poor performance with InflaterDataAccess. Phase 2: inflate into buffer, effective skip and readByte/readBytes()
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Tue, 16 Apr 2013 19:31:57 +0200 |
| parents | 88afffd39899 |
| children | e4a71afd3c71 |
comparison
equal
deleted
inserted
replaced
| 575:8bf184c9d733 | 576:3c4db86e8c1f |
|---|---|
| 100 System.out.println("REPO:" + hgRepo.getLocation()); | 100 System.out.println("REPO:" + hgRepo.getLocation()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 public static void main(String[] args) throws Exception { | 103 public static void main(String[] args) throws Exception { |
| 104 Main m = new Main(args); | 104 Main m = new Main(args); |
| 105 m.checkFileSneakerPerformance2(); | 105 m.checkFileSneakerPerformance(); |
| 106 // m.testRevert(); | 106 // m.testRevert(); |
| 107 // m.testCheckout(); | 107 // m.testCheckout(); |
| 108 // m.tryExtensions(); | 108 // m.tryExtensions(); |
| 109 // m.dumpBookmarks(); | 109 // m.dumpBookmarks(); |
| 110 // m.readConfigFile(); | 110 // m.readConfigFile(); |
| 133 private void checkFileSneakerPerformance() throws Exception { | 133 private void checkFileSneakerPerformance() throws Exception { |
| 134 HgChangesetFileSneaker fs1 = new HgChangesetFileSneaker(hgRepo); | 134 HgChangesetFileSneaker fs1 = new HgChangesetFileSneaker(hgRepo); |
| 135 HgChangesetFileSneaker fs2 = new HgChangesetFileSneaker(hgRepo); | 135 HgChangesetFileSneaker fs2 = new HgChangesetFileSneaker(hgRepo); |
| 136 fs1.followRenames(true); | 136 fs1.followRenames(true); |
| 137 fs2.followRenames(true); | 137 fs2.followRenames(true); |
| 138 Nodeid cset = hgRepo.getChangelog().getRevision(TIP); | 138 Nodeid cset = hgRepo.getChangelog().getRevision(2); |
| 139 Path fname = Path.create("dir3/file8"); | 139 Path fname = Path.create("dir9/file9"); // close to the manifest end |
| 140 fs1.changeset(cset); | 140 fs1.changeset(cset); |
| 141 fs2.changeset(cset); | 141 fs2.changeset(cset); |
| 142 // hgRepo.getManifest().getFileRevision(TIP, fname); | 142 // hgRepo.getManifest().getFileRevision(TIP, fname); |
| 143 final long start1 = System.nanoTime(); | 143 final long start1 = System.nanoTime(); |
| 144 boolean e1 = fs1.checkExists(fname); | 144 boolean e1 = fs1.checkExists(fname); |
| 151 if (!fr.equals(fs1.revision()) || !fr.equals(fs2.revision())) { | 151 if (!fr.equals(fs1.revision()) || !fr.equals(fs2.revision())) { |
| 152 throw new AssertionError(); | 152 throw new AssertionError(); |
| 153 } | 153 } |
| 154 ManifestRevision mr = new ManifestRevision(null, null); | 154 ManifestRevision mr = new ManifestRevision(null, null); |
| 155 final long _s1 = System.nanoTime(); | 155 final long _s1 = System.nanoTime(); |
| 156 hgRepo.getManifest().walk(2, 2, mr); | 156 hgRepo.getManifest().walk(0, 0, mr); |
| 157 final long _e1 = System.nanoTime(); | 157 final long _e1 = System.nanoTime(); |
| 158 hgRepo.getManifest().getFileRevision(2, fname); | 158 hgRepo.getManifest().getFileRevision(0, fname); |
| 159 final long _e2 = System.nanoTime(); | 159 final long _e2 = System.nanoTime(); |
| 160 System.out.printf("\n\tManifestRevision:%d ms, getFileRevision:%d ms\n", (_e1-_s1)/1000000, (_e2-_e1)/1000000); | 160 System.out.printf("\n\tManifestRevision:%d ms, getFileRevision:%d ms\n", (_e1-_s1)/1000000, (_e2-_e1)/1000000); |
| 161 } | 161 } |
| 162 | 162 |
| 163 // -agentlib:hprof=cpu=times,heap=sites,depth=10 | 163 // -agentlib:hprof=cpu=times,heap=sites,depth=10 |
| 164 private void checkFileSneakerPerformance2() throws Exception { | 164 private void checkFileSneakerPerformance2() throws Exception { |
| 165 Path fname = Path.create("dir3/file8"); | 165 Path fname = Path.create("dir9/file9"); // close to the manifest end |
| 166 hgRepo.getManifest().getFileRevision(2, fname); | 166 hgRepo.getManifest().getFileRevision(0, fname); |
| 167 // ManifestRevision mr = new ManifestRevision(null, null); | 167 // ManifestRevision mr = new ManifestRevision(null, null); |
| 168 // hgRepo.getManifest().walk(2, 2, mr); | 168 // hgRepo.getManifest().walk(2, 2, mr); |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
