Hi (yet again),

I ran some tests on the whole Process vs. javac.Main.compile, and came up
with results that are exactly the opposite of what I'd expect.

My assumption: using a Process involves running the command "javac
-d dir File.java", which involves starting up a JVM, which is a
CPU- and memory-intensive operation.  Calling javac.Main.compile within
the currently-running VM doesn't involve starting up a new VM and should
thus use fewer resources and thus finish faster.

The test:
compile all the files in a given directory.  Use
System.currentTimeMillis() to track how long they take.  After assembling
appropriate String arrays called cmd, these are the commands:

new Main(System.out, "javac").compile(cmd);

Runtime.getRuntime().exec(cmd).waitFor();

The results:
Note: I tried with and without TYA, tried changing the order (ie, do
Main(...) first or do Runtime(...) first, with no appreciable change
(stddev swallows up the diffs)

Process: avg 19800, stddev ~500
Main:    avg 23800, stddev ~500

(this is the result of 6 tests)

Hmmm....

Thanks,
dstn.

---------------------------------
Dustin Lang, [EMAIL PROTECTED]

Reply via email to