Skip to main content

DirectByteBuffer performance regression

4 replies [Last post]
mheinz
Offline
Joined: 2005-02-15
Points: 0

The performance regression described in Bug Id 4851535
still exists in recent builds of mustang (b94, b100)

Running the BufferMark Class (see Bug Id 4851535)
results in :

1.5.0_08
java -server BufferMark
Array buffer: 3.12 us per iteration
Direct buffer: 5.64 us per iteration

1.6.0 b94
java -server BufferMark
Array buffer: 25.32 us per iteration
Direct buffer: 40.0 us per iteration

Is this a known bug ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alanb
Offline
Joined: 2005-08-08
Points: 0

Thanks for reporting this. Although the test case attached to 4851535 can be used to demonstrate this slow down it doesn't appear to be the same issue. Instead, this looks like it might be due to some changes in the compiler. We'll update this thread once there is more.

alanb
Offline
Joined: 2005-08-08
Points: 0

Ross Knippel from the compiler team has tracked down this issue. It's in the bug database as 6480445 (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6480445)

sjasja
Offline
Joined: 2004-08-15
Points: 0

In the test program (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4851535) change main() to this:
[pre]
public static void main(String[] args) {
for (int n = 0; n < 5; n++) {
System.out.println("=== round " + n);
BufferMark app = new BufferMark();
app.testWrite();
}
}
[/pre]
This should allow better for Hotspot compilation. Typical microbenchmark gotcha. Any better numbers?

fred34
Offline
Joined: 2004-06-19
Points: 0

Using the adapted main method above, here are my results:

Java1.4.2.12 (Server)

=== round 0
Array buffer: 17.18 us per iteration
Direct buffer: 10.64 us per iteration
=== round 1
Array buffer: 6.56 us per iteration
Direct buffer: 10.64 us per iteration
=== round 2
Array buffer: 6.88 us per iteration
Direct buffer: 10.32 us per iteration
=== round 3
Array buffer: 6.88 us per iteration
Direct buffer: 11.26 us per iteration
=== round 4
Array buffer: 6.88 us per iteration
Direct buffer: 10.62 us per iteration

Java1.6b99 Server
Array buffer: 18.42 us per iteration
Direct buffer: 30.0 us per iteration
=== round 1
Array buffer: 7.5 us per iteration
Direct buffer: 12.18 us per iteration
=== round 2
Array buffer: 6.56 us per iteration
Direct buffer: 13.14 us per iteration
=== round 3
Array buffer: 6.88 us per iteration
Direct buffer: 12.82 us per iteration
=== round 4
Array buffer: 7.82 us per iteration
Direct buffer: 14.36 us per iteration

Mustang is marginally slower on Direct buffer manipulation, but not seeing massive slowdowns as above.

mrheinz..what hardware are you running these tests on? e.g. what CPU/RAM, OS, etc..Thanks