Java 7 runs slower ?

Hey,

sorry for bad english.

i just moved on to java 7 and noticed huge performance issues.

i really don’t know what to do >.<

its the same code and java 6 runs 20-30 times faster than java 7.

made a trace log

java 7

282 calls to sun.java2d.opengl.OGLSwToSurfaceBlit::Blit(IntRgb, AnyAlpha, "OpenGL Surface")
282 calls to sun.java2d.loops.Blit::Blit(IntArgbBm, SrcOverNoEa, IntRgb)
282 calls to sun.java2d.loops.DrawGlyphList::DrawGlyphList(AnyColor, SrcNoEa, AnyInt)
1 call to sun.java2d.opengl.OGLRTTSurfaceToSurfaceBlit::Blit("OpenGL Surface (render-to-texture)", AnyAlpha, "OpenGL Surface")
4 calls to sun.java2d.loops.FillRect::FillRect(AnyColor, SrcNoEa, AnyInt)
1 call to sun.java2d.loops.Blit::Blit(IntRgb, SrcNoEa, IntRgb)

java 6

33621 calls to sun.java2d.loops.Blit::Blit(IntRgb, SrcNoEa, IntArgbPre)
33626 calls to sun.java2d.loops.Blit::Blit(IntRgb, SrcNoEa, IntRgb)
33627 calls to sun.java2d.loops.DrawGlyphListAA::DrawGlyphListAA(AnyColor, SrcNoEa, IntRgb)
100881 total calls to 3 different primitives
852 total calls to 6 different primitives

same options same vm options … i don’t really get it

greetings bert.

What are those trace logs supposed to mean ?
What and how did you measure ?
In any case, no, its not slower.

As this is Java2D, any version can have arbitrary performance on any machine.

A performance difference of factor 30x is not that unusual. It means that the Java2D backend picked the ‘wrong’ renderer (either software, directx, opengl).

thanks so far :slight_smile:

ah okay, is there anyway to force it to use a specific? if yes, is there a way to get the one jre 6 is using?

or is it time to use lwjgl?
tried it a few times, but i dont really get it :confused:

Basically, don’t use Java2D. I used it for a while because it always did what I needed to do, but as soon as I tested my game on Ubuntu the performance dropped to an unplayable level. I discovered Java2D was the culprit and moved on to LWJGL. Haven’t looked back since ;D

JavaFX isn’t bad either. It’s meant to be a Swing / Java2D replacement. Java2D is ancient.

LWJGL is very “low level” and not necessarily a good replacement for Java2D. Simple tasks like rendering an image or drawing shapes will seem rather daunting and complex.

A better solution is to use a library built on OpenGL rendering, like LibGDX.

Only thing to watch out for in libgdx is im pretty sure its 3d stuff is relatively new and constantly being changed / improved - but i still would def try it :slight_smile: