JDK-8029253 : [macosx] Performance problems with Retina display on Mac OS X
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u40,8,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2013-11-27
  • Updated: 2020-11-02
  • Resolved: 2014-10-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9 Other
8u40Fixed 9 b38Fixed openjdk7uFixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Text editing and scrolling in Java Swing applications is slow when running on Mac OS X with a Retina display. To reproduce create a JFrame with a JTextPane and past some large text into the pane. Then start editing the text to force scrolling in the text pane. It will be slow and CPU usage for that process will go over 100%.
The same application running on external display connected to the same machine is much faster with CPU usage never going over 50%.
It is reproducible with JDK 8 build 117 as well. Adjusting resolution scaling in OS X System Preferences makes no difference. The problem is even more severe on MacBook Air computer - probably because their CPUs are less powerful.

See also https://netbeans.org/bugzilla/show_bug.cgi?id=237724
Back ported to 8u40.

Currently I have no plan to backport it to jdk7 until I'll complete everything for jdk8.

Sergey, do we need to back port it to 7u80(Sust)?

j2dbench options file: http://cr.openjdk.java.net/~serb/8029253/drawimage Summary osx-retina Intel HD Graphics 4000 : http://cr.openjdk.java.net/~serb/8029253/perf.04/osx-retina-intel/results.txt base: Number of tests: 24 Overall average: 92015.36146212014 Best spread: 0.0% variance Worst spread: 0.0% variance (Basis for results comparison) fix: Number of tests: 24 Overall average: 616682.7498394073 Best spread: 0.0% variance Worst spread: 0.0% variance Comparison to basis: * Best result: 4899860.24% of basis* Worst result: 100.48% of basis Number of wins: 22 Number of ties: 2 Number of losses: 0 Summary osx-retina Nvidia GeForce GT 650M 1024 MB : http://cr.openjdk.java.net/~serb/8029253/perf.04/osx-retina-nvidia/results.txt base: Number of tests: 24 Overall average: 147138.4952051871 Best spread: 0.0% variance Worst spread: 0.0% variance (Basis for results comparison) fix: Number of tests: 24 Overall average: 634465.9854992364 Best spread: 0.0% variance Worst spread: 0.0% variance Comparison to basis: Best result: 42311.89% of basis Worst result: 77.93% of basis Number of wins: 16 Number of ties: 7 Number of losses: 1

Workaround: use BufferedImage.TYPE_INT_ARGB_PRE images for maximum performance.

This is indirect regression of JDK-4834832. In those fix some special blits were removed: OGLSwToSurfaceScale(SurfaceType.IntArgb, OGLSurfaceData.PF_INT_ARGB) OGLSwToSurfaceTransform(SurfaceType.IntArgb, OGLSurfaceData.PF_INT_ARGB) It was assumed that those blits should be replaced by the general blit, but for some reason it does not happen and we use TransformHelper.

The bug still not fixed in jdk9 as well.

Could you put a note here with the JDK 9 build including the fix, when available? I will ask NetBeans users to try the fix.

The fix was not ready in time of 8u20, it is still under review. Current plan is to fix it in 8u40.

Sergey, did your improvements get into 8u20? NetBeans users continue complaining about scrolling speed, so I am wondering if they should expect that 8u20 is supposed to have the improvement, or if the improvement is planned for a next 8uX update? And is the improvement in JDK 9?


I'll improve speedup of the scrolling in 8u20 on retina + intel. But I am not sure that I'll fix the freezes, since I cannot reproduce them.

Any chance for the fix in 8u20?

The problem is in the glDrawPixels(). It is extremely slow in case of intel integrated video graphics. This issue became obvious on osx + retina

Release team: Approved for deferral.

please re-evaluate it

Profiler snapshot on Retina display: https://netbeans.org/bugzilla/attachment.cgi?id=142655 Profiler snapshot from the same machine on external display: https://netbeans.org/bugzilla/attachment.cgi?id=142656

There is difference under retina: OGLRenderQueueprivate native void flushBuffer(long buf, int limit); 23ms vs 3ms This method executes rendering of opengl and wasn't changed long time.

we are on rampdown stage and any bug needs to be consistent in open state unless incomplete, please reopen within requested data

I have asked the NetBeans bug submitters for profiler snapshots.

I tested netbeans on macbook pro mid 2008(quartz debug) and ealy 2013(pure retina). Scrolling is good and smooth. cpu usage increasing is expected, because application draw 4 times more information. I cannot reproduce the freezes. At least netbeans snapshot from the problem systems is required, to figure out what is going wrong. Seems it could be related to the intel&opengl.

Just use the steps I provided to reproduce the problem in a plain Swing app and generate your profiler snapshot yourself. Let me know if you don't have access to a Retina machine.

Profiler snapshot is needed.

This is not NetBeans only bug! Please read my bug description.

I downgrade the priority, because initial submitter say that the problem is reproduced in Netbeans only. Problem was not reproduced in other java applications(SwingSet for example). Profiler snapshot is needed.

is it affecting jdk8 as well? Where it was introduced, which release?