PHPStorm 在编辑 Javascript 时异常缓慢
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12455277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHPStorm exceptionally slow while editing Javascript
提问by Sherlock
I'm using PHPStorm (5.0) as PHP IDE, but I'm busy building some frontend stuff with Javascript at the moment. The problem is: PHPStorm gets veryslow. It uses all 494M of memory while editing the Javascript file. I don't have any active files other than my Javascript file. The file itself is only 191 lines long.
我正在使用 PHPStorm (5.0) 作为 PHP IDE,但目前我正忙于使用 Javascript 构建一些前端内容。问题是:PHPStorm 变得很慢。它在编辑 Javascript 文件时使用了全部 494M 内存。除了我的 Javascript 文件,我没有任何活动文件。文件本身只有 191 行。
- I invalidated the caches;
- I restarted PHPStorm / my computer;
- I turned off all Javascript inspections.
- 我使缓存无效;
- 我重新启动了 PHPStorm/我的电脑;
- 我关闭了所有 Javascript 检查。
Is there anythingI can do to speed things up?
是否有什么我能做的速度?
回答by 1nfiniti
If you're running a project with an exceptionally large code base, the performance of the IDE can really chug because by default it watches all the files in all subdirectories of your loaded project.
如果您正在运行一个代码库特别大的项目,IDE 的性能会非常糟糕,因为默认情况下它会监视加载项目的所有子目录中的所有文件。
Generally, a large code base will not require watchers on a good portion of the files. You can improve performance by going to File/Settings/Project/Directories
and excluding any folders you do not need to watch/search within.
通常,大型代码库不需要对大部分文件进行观察者。您可以通过转到File/Settings/Project/Directories
并排除您不需要在其中观看/搜索的任何文件夹来提高性能。
If you do need to search within those files, you get the option to include excluded directories and search again anyway.
如果您确实需要在这些文件中进行搜索,您可以选择包含排除的目录并再次搜索。
Also, disabling any plugins you aren't using can help improve performance as well, but not as much as the directories thing.
此外,禁用您不使用的任何插件也有助于提高性能,但不如目录那么多。
回答by proudfist
Fix 1. disable spelling. File->Settings->Editor->Inspections->Spelling
修复 1. 禁用拼写。文件->设置->编辑器->检查->拼写
Fix 2. If on linux try this: In /phpstorm/bin/ you find - phpstorm.vmoptions - phpstorm64.vmoptions
修复 2. 如果在 linux 上试试这个:在 /phpstorm/bin/ 你找到 - phpstorm.vmoptions - phpstorm64.vmoptions
In phpstorm goto help->about and check if JRE is 64 or not. If 64 edit phpstorm64.vmoptions.
在 phpstorm 中转到 help->about 并检查 JRE 是否为 64。如果 64 编辑 phpstorm64.vmoptions。
Insert these 2 lines at the end. -Dawt.java2d.opengl=true -Dsun.java2d.xrender=false
在最后插入这两行。-Dawt.java2d.opengl=true -Dsun.java2d.xrender=false
回答by CrazyCoder
In case of the performance isues file the problem at YouTrackand upload a CPU snapshot, each problem is unique and requires investigation.
回答by Henry
I just went through a fairly detailed process with JetBrains. It turned out it was my secondary monitor. I have a 28" retina display. If I run it on the default resolution 1920x1080 in true retina it runs fine. When I up the resolution the performance really starts to drag. As of right now (June 2016), this is an open issue in their system with no solution.
我刚刚使用 JetBrains 经历了一个相当详细的过程。原来这是我的辅助显示器。我有一个 28 英寸的视网膜显示器。如果我在真正的视网膜中以默认分辨率 1920x1080 运行它,它运行良好。当我提高分辨率时,性能确实开始下降。截至目前(2016 年 6 月),这是一个悬而未决的问题在他们的系统中没有解决方案。
I also discovered that if you use .gitignore, you should also mark these files and directories as 'Excluded' in the IDE. That helps somewhat with larger projects.
我还发现,如果您使用 .gitignore,您还应该在 IDE 中将这些文件和目录标记为“已排除”。这对较大的项目有所帮助。
回答by dpde
I had the same issue a while ago, here is what helped me to resolve it.
不久前我遇到了同样的问题,这是帮助我解决它的原因。
First make sure you exclude the node_modules folder in Settings -> Directories.
首先确保在设置 -> 目录中排除 node_modules 文件夹。
This change made it better for me, but did not resolve all the performance issues I had with JavaScript files.
此更改对我来说更好,但并没有解决我在 JavaScript 文件中遇到的所有性能问题。
- Uninstall PHPStorm
- Download and Install the JetBrains Toolbox (https://www.jetbrains.com/toolbox/app/?fromMenu)
- Install PHPStorm via the JetBrains ToolBox
- Open the PHPStorm settings menu within the Toolbox (Screenshot)
- Increase the maximum heap size to 1024 MB
- Restart PHPStorm
- 卸载 PHPStorm
- 下载并安装 JetBrains Toolbox ( https://www.jetbrains.com/toolbox/app/?fromMenu)
- 通过 JetBrains ToolBox 安装 PHPStorm
- 打开工具箱中的 PHPStorm 设置菜单(截图)
- 将最大堆大小增加到 1024 MB
- 重启 PHPStorm
回答by Turdaliev Nursultan
As of 2018 it's completely different. PHPStorm provides a simple way of changing JVM options.
到 2018 年,情况完全不同。PHPStorm 提供了一种更改 JVM 选项的简单方法。
- From the main menu, choose Help | Edit Custom VM Options
- Change
Xmx
value to a higher value. Default value is750m
. Increasing it to1024m
was enough for me. - Now your PHPStorm should start working as usual.
- 从主菜单中,选择帮助 | 编辑自定义 VM 选项
- 将
Xmx
值更改为更高的值。默认值为750m
。增加它对1024m
我来说就足够了。 - 现在您的 PHPStorm 应该可以正常工作了。
回答by DoctorP
PHPStorm and all Jetbrains products are slow wjen opening large files (2000+ lines of code). You may have a good PC but the problem is not in PC or processor. On the same hardware Eclipse, Netbeans are much better if we are talking about speed. Just read this: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206999515-PhpStorm-extremely-slow-on-large-source-files
PHPStorm 和所有 Jetbrains 产品在打开大文件(2000 多行代码)时都很慢。您可能有一台不错的 PC,但问题不在于 PC 或处理器。在相同的硬件 Eclipse 上,如果我们谈论速度,Netbeans 要好得多。只需阅读:https: //intellij-support.jetbrains.com/hc/en-us/community/posts/206999515-PhpStorm-extremely-slow-on-large-source-files
回答by Damian Kleiman
PHPStorm will always feel slower than native apps on whatever OS you have (I use it on Windows, Linux and Mac), just because Java is slower. I had to do a lot of tweaking to make it feel faster, and the only thing that really improved speed was a SSD hard disk.
PHPStorm 在你拥有的任何操作系统上总是比本地应用程序慢(我在 Windows、Linux 和 Mac 上使用它),只是因为 Java 更慢。我不得不做很多调整才能让它感觉更快,唯一真正提高速度的是 SSD 硬盘。
Try tweaking vmoptions
file a bit and you will get better performance, but dont expect it to behave like native apps. For simple file edits (not projects) just use an editor like Sublime Text, Vim or whatever.
尝试vmoptions
稍微调整文件,您将获得更好的性能,但不要指望它的行为像本机应用程序。对于简单的文件编辑(不是项目),只需使用 Sublime Text、Vim 或其他编辑器。