Sublime Forum

High CPU Usage on File Save


Recently I started to notice whenever I hit Ctrl + S to save file, sublime 3 UI/Editor will freezer for a couple seconds during which I basically cannot do anything. Further checking reveals during this freezing time, CPU usage by sublime rises to 30%+.Because of this, for the time being, I have switch of VSCode. Still I would love to continue to use sublime if this can be solved.

I mostly use sublime for Laravel based PHP/HTML/JavaScript project, don’t consider my project large. I have followed every post with similar issues, checked my index_exclude_patterns, binary file pattern, fresh installation etc. none of them seems to solve my problem.

Thanks in advance.

Update: the high CPU usage thing stopped after I set “index_files”: false. So the problem is definitely somehow related to indexing.



Do you have an example file that causes the issue?

Have you tried reverting to a fresh state?



Hi Wbond,

thanks for your reply. I just reproduced the issue with the following repo:

Steps to reproduce:

  1. Download the repo
  2. Unzip and cd into folder
  3. Open the folder with ST3. It will several minutes to index.
  4. Open a random file, and type something somewhere, then hit Ctrl + S
  5. Observe CPU usage by ST3 in task manager. The usage usually stays high for several to 10+ seconds.

Yes, I tried with fresh installation either by deleting the data folder, or download a portal version. The high CPU usage seems the same.



FWIW, that directory opens imperceptibly instantly for me. I opened filemanager.php and it also saved instantly (even accounting for the fact that I had never compiled the PHP mode before).

My guess is you have some sort of plugin that is causing this.

1 Like


@zhiyong do you see high cpu usage in sublime_text or plugin_host process?



@djspiewak I had 3 plugins, vue syntax highlighter, docblocker, package management, with all these 3 removed, or a clean portable sublime text 3, it still takes minutes to index the above repo, and whenever I hit ctrl + s, there will several seconds of high CPU usage.
@rchl high CPU usage is in ST3 not plugin_host



It could be your (auto) session file being very big. I recently had, what looks like a same issue, where my session file was 16MB big due to a lot of matches in “find in files” results open somewhere in the window.



@rchl How do I fix the issue? Not completely understand the session thing. When I just tested, I have only one ST3 open, and don’t have Shift -Ctrl - F window open anywhere.



Check size of your session file



Just checked the session file, mine is a only 19k, after deleting it, I still have the high CPU usage issue. Not sure if it is my windows. I will try it on a clean Windows 10 installation, and see if that helps.



Just tried it on a fresh installation of windows 10, portable ST3, got the same results. Not sure if it is relevant, I am having issues with sourcetree as well. I had to click on its icon in taskbar many times to bring the ui up, and I don’t see this with mechanic hard drive and otherwise the same machine.

Is it because my computer is too old? Like i5-3320m?



Some further investigation:

The high CPU usage seems to happen only to php files. In the same repo, when I just hit Ctrl + S when inside other files like xml, json, etc. the problem doesn’t happen. Also when it happens, an extra ST3 process will show up in task manager for the duration of high CPU usage then disappear by itself.

This seems to be an old issue, really hope you guys can fix it.