Java Runtime – Why Programs Run Faster in Eclipse Than BlueJ

eclipsejavaruntime

I've been programming for about 2 years, and so far Java is all I know.

When I made the switch from BlueJ to eclipse I noticed my old projects ran much faster. What would be the reason for this, as far as I knew the executing of java byte code is handled by the JVM and I still had the same JVM after I switched. Other than that does eclipse have had a different compiler? That's the only other thing I could think of.

Edit:

I timed it, the average runtime for, we'll call it A(100), in blueJ was 1 Minutes; 8 Seconds; 846 Milliseconds. In eclipse A(100) only took 8 Seconds; 459 Milliseconds. I've also noticed the increase for all my other programs too. I haven't measured those yet but the difference is definitely noticeable.

A() is a function that does alot of computation than prints of a chart of information based on what it found, fyi.

Best Answer

I think the main reason is that BlueJ runs your code in a VM with a debugger attached. BlueJ actually has two VMs running: the main one, and the one with your code inside (the user VM, aka the debug VM). The main VM has a debugger attached to the user VM, which allows it to do things like pause user code, inspect the state of objects and all sorts. I imagine this probably adds a fair bit of overhead (perhaps inhibiting the JIT compilation?); the speed that code executes is not a major concern for a learning environment like BlueJ, as long as it's reasonable.