Skip to main content

Are the snapshots known to be slow?

3 replies [Last post]
biehl
Offline
Joined: 2003-06-19

Hi,

I'm running a performance sensitive app - and when I try the mustang snapshots my runs take a little more than twice as long as when I use 1.5.0_05

Is this to be expected? Am I missing some magic switch?

../{jdk1.5.0_05 | jdk1.6.0}/bin/java -Xmx1000M -Dsample.tmax=0.005 -Dsample.tmin=0.0000005 -Dmatrixfile=energy.dir/flatzero.mat -server -cp ../protfoldAll15d.jar org.protfold.parameteroptim.Optimizer

Thanks,
Anders

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sjasja
Offline
Joined: 2004-08-15

I find most of my code has become faster (hack: I use reflection to run jUnit test methods in a loop and time them). It could be some specific little thing that just happens to be slower. Try to narrow it down...?

One thing that I just noticed that has become slower is object creation and/or garbage collection. Does your program create a lot of objects?

A couple of test programs below. The first one on x86 Windows running with -server:
J2SE 5.0_06: [b]0.6 seconds[/b]
Mustang-b62 binary snapshot: [b]1.0 seconds[/b]

(What, [ code ] tags don't work any more? Well, [ pre ] works...)

[pre]
public class CreateObject
{
public static void main(String args[])
throws Exception
{
System.out.println("Ignore the first few timings.");
System.out.println("They may include Hotspot compilation time.");
System.out.println("I hope you are running me with \"java -server\"!");
for (int m = 0; m < 5; m++)
doit();
}

static void doit()
{
long start = System.currentTimeMillis();

for (int n = 0; n < 10 * 1000 * 1000; n++) {
new CreateObject(); new CreateObject();
new CreateObject(); new CreateObject();
new CreateObject(); new CreateObject();
new CreateObject(); new CreateObject();
new CreateObject(); new CreateObject();
}

long end = System.currentTimeMillis();

System.out.println((end - start) / 1000.0 + " seconds");
}
}

public class IntegerTest
{
public static void main(String args[])
throws Exception
{
System.out.println("Ignore the first few timings.");
System.out.println("They may include Hotspot compilation time.");
System.out.println("I hope you are running me with \"java -server\"!");
for (int m = 0; m < 5; m++)
doit();
}

static void doit()
{
int total = 0;
long start = System.currentTimeMillis();

for (int n = 0; n < 10 * 1000 * 1000; n++) {
Integer x = new Integer(n);
Integer y = new Integer(n);
Integer z = new Integer(n);
total += x.intValue() + y.intValue() - z.intValue();
}

long end = System.currentTimeMillis();

System.out.println((end - start) / 1000.0 + " seconds, total " + total);
}
}
[/pre]

biehl
Offline
Joined: 2003-06-19

Yes - I think my program creates a lot of objects (but I don't know how to quantify that).

Is there anythink I can do to diagnose the cause of the slowness?

(Maybe I can try to profile the app with both jvm's)

Thanks,
Anders

biehl
Offline
Joined: 2003-06-19

Hrm - now I've looked and I am not sure it is object allocation that is bad. I just did various minor cleanups of my code - and woosh

jdk1.5.0_06 : average subloop time 8 -> 7 sek
jdk1.6.0_b62 : average subloop time 23 -> 11 sek

If I have time, I'll try to go back and do some kind of search to see what was the most influential part.