Hey guys,
I have loved Sublime since I came over to it from resource hogs in the past such as Dreamweaver and Eclipse IDE. For a long time (and still now kinda), I really, REALLY loved this software.
However, in 2015, on Sublime Text 3 on my Macbook Pro, I started to notice an odd phenomena. I thought it was the virtual server I was running that had my Macbook’s fan CONSTANTLY kicking on, with my machine hot enough to fry an egg on. But no, I was mistaken kind sirs, SUBLIME TEXT 3 was the culprit! 100% CPU usage, constantly. Now I know what you’re saying, “not my beloved, dear friend Sublime, surely he wouldn’t do that to me?” But he did. Oh, did he ever.
After disabling all plugins, and trying a bunch of other stuff, I finally came to the solution (for me, at least so far). Now, these may be rookie tips, but bear with me just in case someone doesn’t know them.
Tip 1) once you check Activity Monitor or whatever task-manager your OS uses and find that Sublime may be the culprit, inside sublime, use the control+` keyboard shortcut to open up the sublime console. There you may find Sublime repeatedly trying to index the same files, failing, and getting stuck in some sort of infinite file indexing loop. That seems to be the common reason I’ve found for the massive CPU spike anyway… either way, that should give you an idea what to Google.
Tip 2) if your issue is indeed file indexing, what you need to do is either turn indexing off completely (seems like a bad idea) or SEVERELY LIMIT which directories sublime is indexing for you. Note, there are two ways to do this (supposedly), one is with the “binary_file_patterns” key. Adding the file patterns you want to exclude to this array is supposed to leave them visually available in your sidebar, but remove them from the index. This has NOT worked for me. You change setting such as these in Sublime > Preferences > Settings User.
[code]“binary_file_patterns”:
"*.jpg",
"*.jar",
"*.zip",
"my-app-directory",
"my-other-app-directory/sub-dir"
],[/code]
With that setting in place, the crazy Sublime CPU spike still occurred. The other option is to use the “folder_exclude_patterns” key. THIS WORKS. I was on the brink of kicking sublime to the curb once and for all (and in fact started using atom), but there allowed me to keep using this tool I love for a while longer. Quite simply, put everything that is not part of the application code that you actually work on in the folder_exclude_patters list. All frameworks, node_modules, .git, .vagrant, all those wacky directories where you never actually edit anything, they should all be excluded. Sure, they won’t show up in your sidebar, and that sucks, but it’s better than 100% CPU usage. Trust me! Finally, my computer fan is off!
[code]“folder_exclude_patterns”:
"lib/dist",
".svn",
".git",
".hg",
"CVS",
".vagrant",
"WEB-INF",
"lib/media",
"lib/logs",
"lib/svg",
"framework",
"node_modules",
"mxunit"
]
[/code]
I hope this helps someone save their computer and fan. Ps, is Sublime really dead (which is what I’m reading in this forum)? Why don’t the creators care about it? I feel like it should be a great money maker for them. All in all, it is fantastic software and the IDE/editor that I have enjoyed using FAR MORE than any other in my career as a developer. Long live ST, just fix this damn indexing bug, will ya!?