Skip to content

Commit

Permalink
Profiling counting classes (with the help of the Harness and YourKit)…
Browse files Browse the repository at this point in the history
… and speeding it up by 15x. With a one line change.
  • Loading branch information
pascallouisperez committed Nov 3, 2010
1 parent c23d9a4 commit 3b80e4b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jdepend/framework/FileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public boolean acceptJarFile(File file) {

public Collection extractFiles() {

Collection files = new ArrayList();
Collection files = new TreeSet();

for (Iterator i = directories.iterator(); i.hasNext();) {
File directory = (File)i.next();
Expand Down
20 changes: 20 additions & 0 deletions test/jdepend/framework/ProfilingHarness.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package jdepend.framework;

import static java.lang.String.format;

public class ProfilingHarness {

public static void main(String[] args) throws Exception {
long start = System.currentTimeMillis();
for (int i = 0; i < 10; i++) {
JDepend jDepend = new JDepend();
for (String arg : args) {
jDepend.addDirectory(arg);
}
System.out.println(jDepend.countClasses());
}
long end = System.currentTimeMillis();
System.out.println(format("done: %sms", (end - start)));
}

}

0 comments on commit 3b80e4b

Please sign in to comment.