This discussion is archived
2 Replies Latest reply: Dec 13, 2007 10:51 AM by 807557 RSS

Performance issues

807557 Newbie
Currently Being Moderated
Hi,

I'm benchmarking RTSJ memory allocation and GC and am more than surprised by the results.

Basically, the bench consists of the following loop:
for(int i=0;i<500;i++)
{
String[] s = new String[10000];
for(int j=0;j<10000;j++)
{
long before = System.nanoTime();
s = Integer.toString(j);
long after = System.nanoTime();
Log(after-before);
}
}
This code is supplemented with the necessary plumbing to make it run inside a RealtimeThread or a NoHeapRealtimeThread. The bench is ran on Solaris x86.

Using the "regular" JVM, the average allocation/conversion is 247 nanoseconds.
Using a regular thread in RTSJ, the time falls to 370 nanoseconds.
Using a RealtimeThread in RTSJ, the time falls to 521 nanoseconds.
Using a NoHeapRealtimeThread in RTSJ, the time falls to 2084 nanoseconds.

The good news is that the worst allocation times are respectively 2.818.754, 46,923,446, 47,055,542 and 156,876, which shows that NoHeapRealtimeThread reduces latencies by a factor of 18.

However, since the performance penalty is a factor of 10, the good news is more than counter-balanced by the bad news.

Can someone infirm or confirm these figures, and possibly help me obtain better results ?

Eric
  • 1. Re: Performance issues
    807557 Newbie
    Currently Being Moderated
    Are all threads allocating from the same memory area?

    Are all threads run from a fresh VM ie same initial conditions?

    Large arrays get treated differently to smaller objects. You could be seeing a number of different factors at play here.

    If you post the entire working program I'd run it to get another set of data-points. But microbenchmarks like this aren't very meaningful to real programs, because it isn't clear what you are actually measuring.

    David Holmes
  • 2. Re: Performance issues
    807557 Newbie
    Currently Being Moderated
    I'd add to David Holmes' comments:

    - what was the command line (options etc)?
    - home many RTGC reserved bytes?
    - what size was your ImmortalMemory?
    - how many CPUs on the machine?
    - how many CPUs assigned to RTGC?
    - what priority were the threads?
    - what else was occurring on the machine? I/O? etc.
    - which version of Java RTS, 2.0 or 2.0u1?
    - which processor, SPARC or x86?
    - did you print out RTGC statistics?
    - what size heap?
    - why didn't you use Clock.getRealtimeClock().getTime()?
    - how did you account for OS dispatching w/in the set of statements you are measuring?

    Greg