Slow bilinear interpolation of Java2D in Java 7 on Mac OS X

I tested my application on Java 7 on Mac OS X. It works noticeably sluggishly. I used VisualVM to try and track the bottleneck and find the linear interpolation as the culprit:

g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);

To some extent this makes sense, of course. Using interpolation will slow down. But I do not see such a dramatic difference between using and not using interpolation in Java 6 on OS X. In Java 6, the difference was almost negligible. (The images below represent the VisualVM profile paintComponent()after doing standard animation in my application.)

With interpolation:

enter image description here

Without interpolation:

enter image description here

But in Java 7 on OS X, the difference is much more noticeable:

With interpolation:

enter image description here

Without interpolation:

enter image description here

, Apple Oracle. , Apple Java 6 , Oracle Java 7 - . ? ? sun.java2d.opengl=true.

: , setRenderingHints() . , AffineTransformOp, . :

g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
AffineTransformOp scaleOp = new AffineTransformOp(scaleTransform, AffineTransformOp.TYPE_BILINEAR);
scaleOp.filter(screenSliceFiltered, screenSliceFilteredScaled);
+3
1

, . , Apple JVM. Porters group Mac Port OpenJDK.

+1

Source: https://habr.com/ru/post/1535076/


All Articles