pycharm running way slow

后端 未结 9 636
礼貌的吻别
礼貌的吻别 2020-12-07 08:20

I\'m a big fan of PyCharm by JetBrains but I do run into some issues that I thought maybe I\'ll ask here about.

  1. It hangs unexpectedly and this happens often. O
相关标签:
9条回答
  • 2020-12-07 08:36

    Regarding the freezing issue, we found this occurred when processing CSV files with at least one extremely long line.

    To reproduce:

    [print(x) for x in (['A' * 54790] + (['a' * 1421] * 10))]
    

    However, it appears to have been fixed in PyCharm 4.5.4, so if you experience this, try updating your PyCharm.

    0 讨论(0)
  • 2020-12-07 08:42

    In my case, it was very slow and i needed to change inspections settings, i tried everything, the only thing that worked was going from 2018.2 version to 2016.2, sometimes is better to be some updates behind...

    0 讨论(0)
  • 2020-12-07 08:44

    Every performance problem with PyCharm is unique, a solution that helps to one person will not work for another. The only proper way to fix your specific performance problem is by capturing the CPU profiler snapshot as described in this document and sending it to PyCharm support team, either by submitting a ticket or directly into the issue tracker.

    After the CPU snapshot is analyzed, PyCharm team will work on a fix and release a new version which will (hopefully) not be affected by this specific performance problem. The team may also suggest you some configuration change or workaround to remedy the problem based on the analysis of the provided data.

    All the other "solutions" (like enabling Power Save mode and changing the highlighting level) will just hide the real problems that should be fixed.

    0 讨论(0)
  • 2020-12-07 08:46

    Well Lorenz Lo Sauer already have a good question for this. but if you want to resolve this problem through the Pycharm Tuning (without turning off Pycharm code inspection). you can tuning the heap size as you need. since I prefer to use increasing Heap Size solution for slow running Pycharm Application.

    You can tune up Heap Size by editing pycharm.exe.vmoptions file. and pycharm64.exe.vmoptions for 64bit application. and then edit -Xmx and -Xms value on it.

    So I allocate 2048m for xmx and xms value (which is 2GB) for my Pycharm Heap Size. Here it is My Configuration. I have 8GB memory so I had set it up with this setting:

    -server
    -Xms2048m
    -Xmx2048m
    -XX:MaxPermSize=2048m
    -XX:ReservedCodeCacheSize=2048m
    

    save the setting, and restart IDE. And I enable "Show memory indicator" in settings->Appearance & Behavior->Appearance. to see it in action :

    and Pycharm is quick and running fine now.

    Reference : https://www.jetbrains.com/help/pycharm/2017.1/tuning-pycharm.html#d176794e266

    0 讨论(0)
  • 2020-12-07 08:48

    It is super easy by changing the heap size as it was mentioned. Just easily by going to Pycharm HELP -> Edit custom VM option ... and change it to:

    -Xms2048m
    -Xmx2048m
    
    0 讨论(0)
  • 2020-12-07 08:48

    I found a solution to this problem that works beautifully on Windows, and wanted to share it.

    Solutions that didn't work: I have 16GB of RAM and was still having horrible lag. PyCharm takes less than 1GB of RAM for me, so that wasn't the issue. Turning off inspections didn't help at all, and I didn't have any special plugins that I recall. I also tried playing around with CPU affinities for the process, which briefly worked but not really.

    What worked beautifully, almost perfectly:

    1. Set PyCharm's CPU priority to Above Normal
    2. Set the CPU priority for Python processes to Below Normal

    You can do this manually, but I recommend using a program which will preserve the setting across restarts and for multiple instances. I used Process Hacker: Right click on the process -> Priority -> Set the priority. Then right click again -> Process -> and select "Save for pycharm64.exe" and similarly for python "Save for python.exe." Finally in Process Hacker go to Options and select "Start when I log on." This will make it so that ALL Pycharm and python executables acquire these CPU priorities, even after restarting the program and/or Windows, and no matter how many python instances you launch.

    Basically, much of the PyCharm's lag may be due to conflict with other programs. Think about it: Yes PyCharm requires a lot of CPU, but the PyCharm developers aren't stupid. They have probably at least ensured it can run without lag on an empty core. But now you open Chrome and 30 tabs, Fiddler, an FTP program, iTunes, Word, Slack, etc, and they all compete with PyCharm at the same CPU priority level. Whenever the sum of all programs > 100% on a core, you see lag. Switching to Above Normal priority gives PyCharm something closer to the empty core that it was probably tested on.

    As for Below Normal on python.exe, basically you don't want to slow your computer down with your own development. Most python programs are essentially "batch" programs, and you probably won't notice the extra time it takes to run. I don't recommend this if you are developing a graphical interactive program.

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