Speedup IntelliJ-Idea

前端 未结 12 1735
轮回少年
轮回少年 2020-12-22 15:06

I\'m using intelliJ for Scala development and got 8 GB of new RAM last week, so I thought: time to use it. I checked my task manager and found intelliJ using ~2

相关标签:
12条回答
  • 2020-12-22 15:16

    This combination works great on my Intellij13 running in Mavericks:

    Updated Jul 18, 2017:

    # custom IntelliJ IDEA VM options
    
    -ea
    -server
    -Xms2G
    -Xmx4096M
    -Xss2m
    -XX:MaxMetaspaceSize=2G
    -XX:ReservedCodeCacheSize=1G
    -XX:MetaspaceSize=512m
    -XX:+UseConcMarkSweepGC
    -XX:+DoEscapeAnalysis
    -XX:SoftRefLRUPolicyMSPerMB=50
    -XX:+UnlockExperimentalVMOptions
    -Djava.net.preferIPv4Stack=true
    -Dsun.io.useCanonCaches=false
    -XX:LargePageSizeInBytes=256m
    -XX:+UseCodeCacheFlushing
    -XX:ParallelGCThreads=8
    -XX:+DisableExplicitGC
    -XX:+ExplicitGCInvokesConcurrent
    -XX:+PrintGCDetails
    -XX:+PrintFlagsFinal
    -XX:+AggressiveOpts
    -XX:+CMSClassUnloadingEnabled
    -XX:CMSInitiatingOccupancyFraction=60
    -XX:+CMSClassUnloadingEnabled
    -XX:+CMSParallelRemarkEnabled
    -XX:+UseAdaptiveGCBoundary
    -XX:+UseSplitVerifier
    -XX:CompileThreshold=10000
    -XX:+OptimizeStringConcat
    -XX:+UseStringCache
    -XX:+UseFastAccessorMethods
    -XX:+UnlockDiagnosticVMOptions
    -XX:+HeapDumpOnOutOfMemoryError
    -XX:+UseCompressedOops
    -XX:-OmitStackTraceInFastThrow
    -Dawt.useSystemAAFontSettings=lcd
    
    -Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
    

    I keep this setting updated at https://github.com/adben/config/blob/master/idea64.vmoptions

    0 讨论(0)
  • 2020-12-22 15:16

    Made a small write up on this topic on medium: https://medium.com/@sergio.igwt/boosting-performance-of-intellij-idea-and-the-rest-of-jetbrains-ides-cd34952bb978

    0 讨论(0)
  • 2020-12-22 15:18

    Regarding:

    How do I hide this cmd window while running intelliJ through the .bat?

    Use the 'start' command and javaw.exe together, so, if you have:

    SET JAVA_EXE=%IDEA_JDK%\jre\bin\java.exe
    ...
    "%JAVA_EXE%" %JVM_ARGS% -cp "%CLASS_PATH%" %IDEA_MAIN_CLASS_NAME% %*
    

    change it to:

    SET JAVA_EXE=%IDEA_JDK%\jre\bin\javaw.exe
    ...
    start "Intellij IDEA" /b "%JAVA_EXE%" %JVM_ARGS% -cp "%CLASS_PATH%" %IDEA_MAIN_CLASS_NAME% %*
    
    0 讨论(0)
  • 2020-12-22 15:25

    You can find good tips here. For example, the speed of switching from IDEA to another app and vice versa was significantly improved after turning the feature "Turn off Synchronize Files" off.

    http://hamletdarcy.blogspot.com/2008/02/10-tips-to-increase-intellij-idea.html

    0 讨论(0)
  • 2020-12-22 15:25

    Not sure why it has not been mentioned yet - you can enable Power Save mode, which turns off many IJ background activities, including Files Synchronization. Some articles says that it is possible to disable Files Sync in project structure options (like the article in answer by @OJ278), but I was not able to find this option in IJ 14, but Power Save mode seems to disable it.

    I have a quite large code base (AOSP source code), so HD activity due to background files synchronization is annoying...

    0 讨论(0)
  • 2020-12-22 15:32

    Some time ago I was looking for the ways to speedup my project's compilation and that is result. This is not for IntelliJ IDEA itself but will help a lot when (re)building a big projects and, I guess, it will work with any other IDEs too. Also, I described Linux approach, but I'm sure Windows have it's own RAM-disk implementations.

    The easiest way to speedup compilation is to move compilation output to RAM disk.

    RAM disk setup

    Open fstab

    $ sudo gedit /etc/fstab
    

    (instead of gedit you can use vi or whatever you like)

    Set up RAM disk mount point

    I'm using RAM disks in several places in my system, and one of them is /tmp, so I'll just put my compile output there:

    tmpfs /var/tmp tmpfs defaults 0 0
    

    In this case your filesystem size will not be bounded, but it's ok, my /tmp size right now is 73MB. But if you afraid that RAM disk size will become too big - you can limit it's size, e.g.:

    tmpfs /var/tmp tmpfs defaults,size=512M 0 0
    

    Project setup

    In IntelliJ IDEA, open Project Structure (Ctrl+Alt+Shift+S by default), then go to Project - 'Project compiler output' and move it to RAM disk mount point:

    /tmp/projectName/out
    

    (I've added projectName folder in order to find it easily if I need to get there or will work with several projects at same time)

    Then, go to Modules, and in all your modules go to Paths and select 'Inherit project compile output path' or, if you want to use custom compile output path, modify 'Output path' and 'Test output path' the way you did it to project compiler output before.

    That's all, folks!

    P.S. A few numbers: time of my current project compilation in different cases (approx):

    HDD:     80s
    SSD:     30s
    SSD+RAM: 20s
    

    P.P.S. If you use SSD disk, besides compilation speedup you will reduce write operations on your disk, so it will also help your SSD to live happily ever after ;)

    0 讨论(0)
提交回复
热议问题