Permalink
Browse files

Profiling counting classes (with the help of the Harness and YourKit)…

… and speeding it up by 15x. With a one line change.
  • Loading branch information...
1 parent c23d9a4 commit 3b80e4b4bf5c254c2e2319f6e4577a32cbe93d1e @pascallouisperez pascallouisperez committed Nov 3, 2010
Showing with 21 additions and 1 deletion.
  1. +1 −1 src/jdepend/framework/FileManager.java
  2. +20 −0 test/jdepend/framework/ProfilingHarness.java
@@ -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();
@@ -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.