Sublime Forum

[Solved] High CPU Usage in Beta 3124

#21

What Jade syntax are you using? Can you provide an example of a .jade file that causes ST to hang?

Have you tried installing a newer version of the JavaScript syntax, as discussed at [Solved] High CPU Usage in Beta 3124?

0 Likes

#22

Here is an example of a .jade file

:doc
  @name Toolbar
  @props {Boolean} [left]
  @props {Boolean} [center]
  @props {Boolean} [right]

import './index.ess'

var classFn = this.composeClasses('Toolbar')

.Toolbar(className=classFn())
  div(className=classFn('&-inner'))
    if props.left
      div(className=classFn('&-left'))
        yield left

    if props.center
      div(className=classFn('&-center'))
        yield center

    if props.right
      div(className=classFn('&-right'))
        yield right

:module
  export var mixins = [require('ui-kit/mixins/compose-classes')]

I havenā€™t tried updating my js syntax, iā€™ll try that now. Is there a way to reset the state on ST? i canā€™t open it currently because of the feature of re-opening files where i left off, so it re-opens a file that it is hanging on, and all i can do is force quit.

(FYI, iā€™m on OSX El Capitan)

0 Likes

#23

You could wipe your Local/Session.sublime-session file, but you probably donā€™t want to do that. Installing the JavaScript.sublime-syntax override is likely to fix what you are running into.

0 Likes

#24

Why wouldnā€™t i want to wipe the Local/Session.sublime-session file? Iā€™m not worried about losing any changes, if that is the concern there.

0 Likes

#25

It just kills all of your history (recent projects, searches, and more). Any adjustments youā€™ve made to the size of UI panels, or options, like the Find panel.

0 Likes

#26

Well, i killed it, it was a choice between ST not working at all, re-installing, or just losing that, which i would have anyway for the other two options. Adding the Javascript.sublime-syntax override did solve my problem. Has the underlying problem been diagnosed? I have about 30 colleagues who will all have this issue when they update. I warned them all this morning to not update because of this

0 Likes

#27

The underlying issue is that the Jade syntax uses regex constructs that arenā€™t supported by our newer regex engine. It ends up including the JavaScript syntax that ships with Sublime Text. That syntax uses a regex that works fine on a non-backtracking engine (like our newer engine), but once combined with the regexes from Jade it causes catastrophic backtracking in the Oniguruma engine.

Unfortunately it seems that none of the users of the dev builds utilize the Jade syntax, nor the MarkdownEditing syntax with fenced js code blocks.

3 Likes

#28

Iā€™m a dev build user and I refuse to use any syntax that wonā€™t use the sregex engine, so thatā€™s why I never discovered it :wink:

it shows how important it is to get an even more diverse group of people on the dev builds thoughā€¦ consider using them, people! :smiley:

0 Likes

#29

Well thatā€™s unfortunate. Iā€™ll let my team know about the override. Anyway, thanks for all the help! Iā€™ll check into using the dev builds, maybe i can at least cover the jade syntax issues.

lol and maybe some day iā€™ll have the luxury of choosing my syntax, but today is not that day. And, honestly i love the dev perks of using jade, itā€™s unfortunate that itā€™s conflicting so bad with ST

0 Likes

#30

I guess Iā€™m special in that I manage to find the time to hack together my own syntax that is suitable enough for my needs :wink: I donā€™t tend to regularly work on many different file types though, which makes it easier :stuck_out_tongue:

0 Likes

#31

Hi WBond,
Thanks for the updateā€¦but I guess Iā€™m kind of wondering if there is a bigger fix possible? Iā€™ve been reporting the miserable experiences that indexing and broken plugins create for a long time now. For anyone developing NodeJS (and probably other dependency-heavy platforms as well), huge directory trees are the norm - not an edge case.

Could Sublime:

  • be smarter about whether to index dependencies by default?
  • count the number of files to be indexed, and warn the user when a massive indexing job is about to start?
  • drop the priority of long-running indexing tasks so they donā€™t take over your whole computer?
  • give the user better feedback about whatā€™s going on?
  • detect plugins that are known to be problematic and warn the user, offering to disable them?

This is probably the 4th or 5th time Iā€™ve had a situation where some change (plugin, new Sublime build, etc) causes my whole editing experience to grind to a halt, and the solution always involves hackily editing config files, looking under the hood etc. Surely my experience is not rare.

0 Likes

#32

Could everyone install dev build 3125 and see how it helps?

Weā€™ve included the JavaScript change, but also made some tweaks to the default number of index_workers. Jon created a new Help > Index Statusā€¦ window to show all of the indexing activity.

Weā€™ve got some more tweaks planned for the future, but hopefully these changes should help users experiencing acute behavior.

0 Likes

#33

Fundamentally there really arenā€™t issues with large folder trees. I dogfood ST on a daily basis with projects of around 100k files and regularly work on the syntax definitions, where saving a syntax definition triggers reindexing.

We made a tweak in 3125 to the default number of workers that should address users who donā€™t care for fans spinning up on their laptops.

Sublime Text already sets indexers as low priority. While it is true that the indexers will use spare CPU, it shouldnā€™t really ā€œtake overā€ unless the OS has trouble scheduling. Our tweak to the default number of indexers should help reduce this symptom.

The Console shows errors in indexing, to allow the user to find issues with syntaxes. The progress of indexing is displayed in the status bar, and there is a new Index Status window in build 3125 allowing users to see exactly what is going on.

Weā€™ve got some ideas about further ways we can make the indexing process even more robust.

One of the best ways to help ensure that betas donā€™t run into situations like we are discussing here is to help test the dev builds and help test the third-party packages you use with the dev builds. :slightly_smiling:

2 Likes

#34

I switched to build 3125 and removed my Javascript.sublime-syntax and the indexing seems to have worked properly (the output was error free). Thanks for the fix! iā€™ll try and keep up with dev builds in the future.

0 Likes

#35

I canā€™t even paste with out having it hang. Not sure how such a basic functionality could do that. Iā€™ve exited and restarted about 6 times in the past 10 minutes. Also it is just 3 lines of code. Iā€™m probably just going to switch to Atom this weekend

0 Likes

#36

Is this build 3125 you are talking about? If so, what syntax are you using when you try to paste?

0 Likes

#37

This is 3124. I am trying to paste a simple html snippet. In to a 95 line file

0 Likes

#38

Oh, you should try dev build 3125 and confirm that it works.

The issue is that a third-party package you have installed (MarkdownEditing, Jade, or possibly some other) uses regexes that combined with regexes in the default JavaScript syntax cause catastrophic backtracking on the Oniguruma regex engine when combined with certain code.

We shipped a dev build with a fix for it last night and are planning to ship a new beta shortly.

0 Likes

#39

I may when I am less mad at sublime. With the latest updates Iā€™ve probably lost an hour or so. Not counting the times I lost work because I tried to paste like a fool. I mean the background updates of packages usually makes it hang for about 10 minutes with no indication of what is going on

0 Likes

#40

Beta 3126 has been released.

Thanks everyone for helping to identify the issue!

3 Likes