January 10, 2019
-
IDEA Version and JVM runtime (JVM is the bundled one by JetBrains):
IntelliJ IDEA 2018.3.3 (Ultimate Edition) Build #IU-183.5153.38, built on January 9, 2019 JRE: 1.8.0_152-release-1343-b26 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.13.6
IDEA installed via JetBrain Toolbox
-
Custom VM settings:
cat $HOME/Library/Preferences/IntelliJIdea2018.3/idea.vmoptions
:# custom IntelliJ IDEA VM options -Xms128m -Xmx3000 -XX:ReservedCodeCacheSize=240m -XX:+UseCompressedOops -Dfile.encoding=UTF-8 -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djdk.http.auth.tunneling.disabledSchemes="" -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Xverify:none -XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log -XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof
-
No JavaFX involved:
jstack <IDE pid> | grep -i Renderer
-
Mac Hardware:
-
Macbook Hardware:
- MacBook:
MacBook Pro (Retina, 13-inch, Early 2015)
- Processor:
3.1 GHz Intel Core i7
- Memory:
16 GB 1867 MHz DDR3
- Graphics:
Intel Iris Graphics 6100 1536 MB
- MacBook:
-
Display(s):
system_profiler SPDisplaysDataType
Graphics/Displays: Intel Iris Graphics 6100: Chipset Model: Intel Iris Graphics 6100 Type: GPU Bus: Built-In VRAM (Dynamic, Max): 1536 MB Vendor: Intel Device ID: 0x162b Revision ID: 0x0009 Metal: Supported, feature set macOS GPUFamily1 v3 Displays: Color LCD: Display Type: Built-In Retina LCD Resolution: 2560 x 1600 Retina Framebuffer Depth: 24-Bit Color (ARGB8888) Mirror: Off Online: Yes Rotation: Supported Automatically Adjust Brightness: No LG Ultra HD: Resolution: 3840 x 2160 (2160p 4K UHD - Ultra High Definition) UI Looks like: 3840 x 2160 @ 60 Hz Framebuffer Depth: 24-Bit Color (ARGB8888) Main Display: Yes Mirror: Off Online: Yes Rotation: Supported Automatically Adjust Brightness: No Connection Type: DisplayPort
-
But I also tested without external displays, only with
Default for display
resolution setting: Output ofsystem_profiler SPDisplaysDataType
:Graphics/Displays: Intel Iris Graphics 6100: Chipset Model: Intel Iris Graphics 6100 Type: GPU Bus: Built-In VRAM (Dynamic, Max): 1536 MB Vendor: Intel Device ID: 0x162b Revision ID: 0x0009 Metal: Supported, feature set macOS GPUFamily1 v3 Displays: Color LCD: Display Type: Built-In Retina LCD Resolution: 2560 x 1600 Retina Framebuffer Depth: 24-Bit Color (ARGB8888) Main Display: Yes Mirror: Off Online: Yes Rotation: Supported Automatically Adjust Brightness: No
-
Font rendering seems to use a lot of CPU cycles. I tested in a new project, in a newly created (empty) Text-File (test.txt
)
to rule out issues with code completion, etc.
When pressing (and keeping pressed) a single letter on the keyboard, the CPU load goes up and in some cases (IDEA in fullscreen on high resolution display) IDEA cannot keep up with rendering the letters in the speed it gets typed.
When I stop pressing the key, IDEA takes several seconds to catch up, until all the text is finally rendered. The CPU load goes down again immediately afterwards.
While it is pretty clear to see how the CPU load goes up with a single key-press and goes down immediately afterwards, I'm not sure if this is the root problem.
Interesting:
When I use an external 4K display on full resolution (display's native resolution), the CPU load seems to be less than when using a scaled (lower) resolution, but the lagging seems to be worse using the 4k display?
I also used "Quartz Debug" (from the "Graphics Tools for Xcode" package, see also here) to check when and what IDEA is redrawing.
It seems that IDEA is always (on each typing, on each caret blink, ..) redrawing the whole UI (not only the editor part). (see video below)
-
File -> Invalidate Caches and Restart
- didn't notice any difference
-
Preferences - > Appearance -> Antialiasing (IDE and Editor) -> "Grayscale" and also tried "No antialiasing"
- maybe a little bit better? But might also be placebo (when holding down a single letter in keyboard, CPU load goes still to
-
Tested settings (which didn't seem to have an effect for this issue)
-
-Xmx
setting: tested from around300
up to4000
(system has 16 GB RAM) -
-Dsun.java2d.opengl
: tested withfalse
,true
andTrue
(as indicated here: System Properties for Java 2D Technology and in this forum issue: Intelij IDE stopped working correctly with External monitor on Mac OS 10.13.1
-
-
tried enabling Java2D tracing:
-Dsun.java2d.trace=log,ptime,name:OGLTR_AddToGlyphCache,out:/tmp/java2d_trace.txt
-Dsun.java2d.trace=log,timestamp,ptime,out:/tmp/java2d_trace.txt,verbose
-
Installed
JB SDK Bintray Downloader
plugin and for testing switched back to exactly the 1.8.0_152-release-1248-b8 runtime JetBrains runtime version as the Realease Notes of 1.8.0_152-release-1248-b8 x86_64 indicate that JRE-526 got fixed? Seems to be similiar to current JRE version.
-
High CPU load, only using internal display, not scaled (no external displays): https://photos.app.goo.gl/T54q65izvAtqzfi87 The CPU load goes up on typing very noticable, but it doesn't hang on typing
-
External 4K display connected, showing scaled and native performance: https://photos.app.goo.gl/qrsiEf4EfqBiQ7Xe8
-
Using the "Quartz Debug" tool from Xcode Graphics package to highlight screen update areas: https://photos.app.goo.gl/fsxgEHXCsTzKL37w7 It seems like IDEA is always (on each character) redrawing the whole window (not only the editor)
- Support Article: Configuring JVM options and platform properties
- Support Article: Directories used by the IDE to store settings, caches, plugins and logs
- Support Article: Switching Boot JDK
- Jetbrains Confluence: Java2D Rendering Logging
- Jetbrains Confluence: Fonts Layout Rendering
- Release notes of JB runtime (indicating that JRE-526 is fixed?): Realease Notes 1.8.0_152-release-1248-b8 x86_64
- Oracle: System Properties for Java 2D Technology
- The "mega" Issue JRE-526 (lots of comments): IDE is unusably slow when using a 4K display on OS X
- Forum Issue: Extreme lag and high CPU usage on OSX High Sierra
- Forum Issue: Intelij IDE stopped working correctly with External monitor on Mac OS 10.13.1
- Old Forum Issue (2014, probably unrelated?): CPU usage 100%
- YouTrack Issue, migration from OpenGL to Metal (work in process): Improve java2d rendering performance on macOS by using Metal framework
cd "$HOME/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/183.4886.37/IntelliJ IDEA.app/Contents/MacOS"
export _JAVA_OPTIONS='-Dsun.java2d.opengl=false'
./idea