Search code examples
performancephpstormphpstorm-2017.1phpstorm-2016.3

PhpStorm 2016 and 2017 very slow for php projects on MacOS


My PhpStorm 2016 start to slow down for php/js projects (laravel, angular, ionic).

First I try to change JDK do JetBrains JDK but this not help :(

Then I try to upgrade PhpStorm to 2017 - a little better but still not help (especially with php)

My CPU usage for PhpStorm is ~150%. It is very hard to use and work - what to do?


Solution

  • I accidently find answer when read article about JVM options in PhpStorm where in some comment one person put its config. So on my Mac in file (but first make backup copy):

    /Applications/PhpStorm.app/Contents/bin/phpstorm.vmoptions

    I replace below old content:

    -Xms128m
    -Xmx750m
    -XX:ReservedCodeCacheSize=240m
    -XX:+UseCompressedOops
    

    With following new content:

    -server
    -Xss256k
    -Xms1536m
    -Xmx1536m
    -Xmn512m
    -XX:PermSize=350m
    -XX:MaxPermSize=350m
    -XX:MetaspaceSize=350m
    -XX:MaxMetaspaceSize=350m
    -XX:+UseParNewGC
    -XX:SurvivorRatio=8
    -XX:+UseConcMarkSweepGC
    -XX:+CMSScavengeBeforeRemark
    -XX:+CMSPermGenSweepingEnabled
    -XX:+UseCMSInitiatingOccupancyOnly
    -XX:+UseCMSCompactAtFullCollection
    -XX:CMSFullGCsBeforeCompaction=0
    -XX:CMSInitiatingOccupancyFraction=70
    -XX:ReservedCodeCacheSize=240m
    -XX:+HeapDumpOnOutOfMemoryError
    

    And it works very smoothly now :) (CPU usage for PhpStorm is about ~15% now)