Sublime Forum

Intermittent beachballing when typing

#1

Running Sublime Text 3 dev channel build (3131) on macOS Sierra but I’ve seen this problem on the main channel as well.

Sometimes when I’m typing the app will hang and I will get a beachball for several seconds. Additionally switching between files in a project with the Goto Anything panel can be slow in some projects.

I have a feeling that it may be related to a plugin, because I’m running the same build on a different machine and not seeing these problems with the same projects. Is there a way to see how much CPU time various plugins are using? What is the best way to diagnose this problem?

0 Likes

#2

Tools > Developer > Profile Plugins from the main menu will show you timing breakdowns for all of the event handlers that various packages have implemented, which may be of some assistance here.

For something like this happening when you’re typing something like on_modified/on_selection_modified are potentially the most likely, since they trigger on an ongoing basis (as opposed to say views being focused and such).

This won’t tell you about anything that background processes spawned by the plugins may be doing to slow things down, though.

1 Like

#3

Is you lag problems like this? (When I typed amxxsh there was a blank screen freeze, it always happens for some syntaxes the first time I open then after Sublime Text start)

I think it happens the first time you load a file on some syntaxes as Shell Script. After the first time a syntax as Shell Script is loaded, that does not happen again for Shell Script files, until I restart Sublime Text.

0 Likes

#4

@OdatNurd - Thanks for the info. I ran Profile Plugins. It looked like GitGutter and Bracket Highlighter were using the most time, but disabling both of those did not improve anything. The problem still seems to be happening while switching between files in the Goto Anything panel, which brings me to:

@addons_zz - That is similar to the problem I’m seeing, but it doesn’t matter whether or not I’ve loaded the syntax already – I’m in a (mostly) JavaScript project, and switching between JS files still triggers the issue.

I will note that this is a relatively large project, and I’m wondering if that has anything to do with it as well. Perhaps something involved with indexing?

0 Likes

#5

You should be able to use Help > Indexing Status to see if there is any indexing going on in the background or not. Note however that indexing runs distinctly from navigation, but if it’s trying to index the universe of node_modules (that may not be the right name) for example, that could take a bunch of time.

1 Like

#6

As an aside and out of curiosity, are you using the default JavaScript syntax that ships with Sublime, or something third party? There is some small possibility that like the shell script problem mentioned above, if one of your machines was using a third party or modified JavaScript syntax that is not particularly performant while the other is not, that might cause slowdowns while previewing files, for example.

1 Like

#7

Unless the indexing is running, it should not lag your interface. This is the indexer status. When it is complete it does show nothing:

Unless the files you are opening very big as 1MB of size, it should not lag. But perhaps a third part Javascript syntax could be consuming too much Sublime Text resources. Do you use the default Sublime Text syntax for Javascript? Perhaps you can try some third part syntax and test whether the problem persists.

Also, did you under-clocked you computer? I under-clocked mime to 1GHz, but have usually have RAM available. Perhaps is there too much RAM or CPU usage by other programs.

Yesterday I find out one Sublime Text plugin causing Sublime Text to leak memory and crash after typing text for some time. This is the video I recorded during one of the tests. Later I will publish a complete report on how did I nailed it down. On this, I put a another computer program to type a text for me, while I monitor the Sublime Text RAM and Memory usage. After few minutes running Sublime Text, it reached about 1.7GB of RAM use, and crashed:

https://vid.me/mW6Ky

After hours of search, I find out this was because of this package: https://github.com/shagabutdinov/sublime-goto-last-edit-enhanced

Now I am looking into its source code (about 50 lines) and trying to create a minimal example on how and why it is making Sublime Text leak memory and crash.

0 Likes

#8

Actually, I’m using the JavaScriptNext pacakge: https://packagecontrol.io/packages/JavaScriptNext%20-%20ES6%20Syntax

But I believe I’m running that same package on my other machine and not running into these issues. I can confirm later today. (Additionally, after switching my default syntax back to the built-in JavaScript, I’m still seeing the slowdowns.)

The largest JS file in my project directory seems to be about 100 kB. Sublime seems to be using 112 MB memory, 260 MB real mem.

0 Likes

#9

Perhaps you could compare these machines configurations:

  1. Sublime Text version
  2. Packages Installed
  3. CPU Speed
  4. RAM available/usage
  5. Operating System

Try revert Sublime Text to a clean/vanilla install and test whether this problem happens with the default installation:

  1. https://www.sublimetext.com/docs/3/revert.html
0 Likes