Sublime Forum

LSP super slow of late

#1

I am using LSP in Sublime 4 which I have been very happy with.

But lately my cursor freezes for a second or so very routinely as I type. I disabled loads of packages and nothing changed until I turned off LSP.

So I have LSP + two LSP-related language packs going.

Could I have some settings that are messing with me and making LSP interrupt my typing constantly?

Any advice?

0 Likes

#2

Can you:

  1. Reproduce the slow typing a few times, and then
  2. click on Tools > Developer > Profile Plugins…
  3. Paste the result here?
1 Like

#3

I am not seeing any numbers in there that explain anything. None of my plugins is using up that much time at all. It seems to be when it’s deciding to popup a completion menu.

This list shows how much time each plugin has taken to respond to each event:

on_activated:
BracketHighlighter.bh_core: 0.010s total, mean: 0.000s, max: 0.000s
Default.history_list: 0.019s total, mean: 0.000s, max: 0.001s
Emacs Pro Essentials.jove: 0.002s total, mean: 0.000s, max: 0.000s
GitGutter.modules.events: 0.023s total, mean: 0.000s, max: 0.001s
SideBarEnhancements.SideBar: 0.033s total, mean: 0.000s, max: 0.001s
SublimeLinter.active_linters_view: 0.007s total, mean: 0.000s, max: 0.000s
SublimeLinter.busy_indicator_view: 0.012s total, mean: 0.000s, max: 0.000s

on_close:
Better CoffeeScript.CoffeeScript: 0.000s total, mean: 0.000s, max: 0.000s
Emacs Pro Essentials.jove: 0.000s total, mean: 0.000s, max: 0.000s
GitGutter.modules.events: 0.000s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.001s total, mean: 0.000s, max: 0.000s
SublimeLinter.active_linters_view: 0.000s total, mean: 0.000s, max: 0.000s
SublimeLinter.highlight_view: 0.000s total, mean: 0.000s, max: 0.000s
SublimeLinter.sublime_linter: 0.007s total, mean: 0.001s, max: 0.001s
WordCount.WordCount: 0.000s total, mean: 0.000s, max: 0.000s

on_deactivated:
Emacs Pro Essentials.jove: 0.096s total, mean: 0.001s, max: 0.002s
GitGutter.modules.events: 0.003s total, mean: 0.000s, max: 0.000s

on_hover:
BracketHighlighter.bh_core: 0.007s total, mean: 0.000s, max: 0.000s
Default.symbol: 0.001s total, mean: 0.000s, max: 0.000s
GitGutter.modules.events: 0.003s total, mean: 0.000s, max: 0.002s
LSP.plugin.documents: 0.022s total, mean: 0.000s, max: 0.002s
SublimeLinter.highlight_view: 0.002s total, mean: 0.000s, max: 0.000s

on_init:
LSP.plugin.core.panels: 0.000s total

on_load:
BracketHighlighter.bh_core: 0.001s total, mean: 0.000s, max: 0.000s
Default.exec: 0.010s total, mean: 0.000s, max: 0.006s
GitGutter.modules.events: 0.007s total, mean: 0.000s, max: 0.001s
LSP.boot: 0.000s total, mean: 0.000s, max: 0.000s
SimpleCov.ruby_coverage_status: 0.002s total, mean: 0.000s, max: 0.001s

on_modified:
Better CoffeeScript.CoffeeScript: 0.172s total, mean: 0.000s, max: 0.006s
BracketHighlighter.bh_core: 0.242s total, mean: 0.000s, max: 0.013s
Default.history_list: 0.287s total, mean: 0.000s, max: 0.000s
Emacs Pro Essentials.jove: 2.950s total, mean: 0.001s, max: 0.240s
GitGutter.modules.events: 0.336s total, mean: 0.000s, max: 0.031s
PackageResourceViewer.package_resource_viewer: 0.297s total, mean: 0.000s, max: 0.013s
SideBarEnhancements.SideBar: 0.284s total, mean: 0.000s, max: 0.018s
SublimeLinter.highlight_view: 1.105s total, mean: 0.000s, max: 0.076s

on_new:
SideBarEnhancements.SideBar: 0.001s total, mean: 0.000s, max: 0.000s

on_new_window:
LSP.plugin.core.panels: 0.000s total, mean: 0.000s, max: 0.000s

on_post_save:
Better CoffeeScript.CoffeeScript: 0.001s total, mean: 0.000s, max: 0.000s
Emacs Pro Essentials.jove: 0.006s total, mean: 0.001s, max: 0.006s
GitGutter.modules.events: 0.007s total, mean: 0.001s, max: 0.006s
SideBarEnhancements.SideBar: 0.025s total, mean: 0.001s, max: 0.012s

on_post_text_command:
Default.history_list: 0.015s total, mean: 0.000s, max: 0.000s
Default.paste_from_history: 0.006s total, mean: 0.000s, max: 0.000s
Emacs Pro Essentials.jove: 0.471s total, mean: 0.001s, max: 0.067s
Emmet.main: 0.008s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.035s total, mean: 0.000s, max: 0.005s

on_post_window_command:
Emacs Pro Essentials.jove: 0.002s total, mean: 0.000s, max: 0.000s
LSP.boot: 0.003s total, mean: 0.000s, max: 0.000s
SublimeLinter.panel_view: 0.002s total, mean: 0.000s, max: 0.000s

on_pre_close:
Default.history_list: 0.001s total, mean: 0.000s, max: 0.000s
LSP.boot: 0.000s total, mean: 0.000s, max: 0.000s
SublimeLinter.highlight_view: 0.000s total, mean: 0.000s, max: 0.000s
SublimeLinter.panel_view: 0.000s total, mean: 0.000s, max: 0.000s

on_pre_save:
Emacs Pro Essentials.jove: 0.127s total, mean: 0.012s, max: 0.061s
HTMLBeautify.HTMLBeautify: 0.030s total, mean: 0.003s, max: 0.029s
PackageResourceViewer.package_resource_viewer: 0.011s total, mean: 0.001s, max: 0.011s
SublimeAStyleFormatter.AStyleFormat: 0.027s total, mean: 0.002s, max: 0.012s

on_query_completions:
CSS.css_completions: 0.006s total, mean: 0.000s, max: 0.000s
Emacs Pro Essentials.complete_all_buffers: 1.354s total, mean: 0.011s, max: 0.059s
Emmet.main: 0.000s total, mean: 0.000s, max: 0.000s
HTML.html_completions: 0.009s total, mean: 0.000s, max: 0.000s
HTML5.html_completions: 0.006s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.017s total, mean: 0.000s, max: 0.000s
Sass.sass_completions: 0.007s total, mean: 0.000s, max: 0.000s

on_query_context:
BracketHighlighter.bh_wrapping: 0.002s total, mean: 0.000s, max: 0.000s
Default.block: 0.003s total, mean: 0.000s, max: 0.000s
Emacs Pro Essentials.jove: 0.065s total, mean: 0.000s, max: 0.037s
Emmet.main: 0.002s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.008s total, mean: 0.000s, max: 0.000s
PowerCursors.power_cursors: 0.005s total, mean: 0.000s, max: 0.000s
SublimeAStyleFormatter.AStyleFormat: 0.002s total, mean: 0.000s, max: 0.000s
iOpener.i_opener: 0.005s total, mean: 0.000s, max: 0.000s

on_selection_modified:
BracketHighlighter.bh_core: 0.319s total, mean: 0.000s, max: 0.021s
Default.history_list: 0.249s total, mean: 0.000s, max: 0.003s
Emacs Pro Essentials.jove: 2.350s total, mean: 0.000s, max: 0.193s
GitGutter.modules.events: 0.139s total, mean: 0.000s, max: 0.053s
SimpleCov.ruby_coverage_status: 0.146s total, mean: 0.000s, max: 0.012s

on_text_changed:
LSP.plugin.documents: 0.496s total, mean: 0.000s, max: 0.032s

on_text_command:
Default.history_list: 0.033s total, mean: 0.000s, max: 0.000s
Emacs Pro Essentials.jove: 0.514s total, mean: 0.001s, max: 0.041s
Emmet.main: 0.003s total, mean: 0.000s, max: 0.000s
SublimeLinter.highlight_view: 0.004s total, mean: 0.000s, max: 0.000s

on_window_command:
Default.history_list: 0.018s total, mean: 0.000s, max: 0.000s
Emacs Pro Essentials.jove: 0.002s total, mean: 0.000s, max: 0.000s
LSP.plugin.core.panels: 0.009s total, mean: 0.000s, max: 0.000s

wrapper:
Emmet.main: 0.232s total, mean: 0.000s, max: 0.001s

0 Likes

#4

The on_text_changed of LSP does seem a bit high. Emacs Essential also looks high. Did you install that recently? Could there be some interaction between these two packages?

0 Likes

#5

Emacs Pro Essentials is my plugin.

Are you talking about on_text_command? Or on_text_changed?

I figured it’s important to look at the mean value of these measurements?

The delays are much more than 50ms or event 100ms.

I am not sure what my plugin is doing but it’s trying to be emacs, and there’s a lot it needs to get just right. But I was sad to see that…

But it’s definitely LSP related. I disabled LSP and all delays go away.

0 Likes

#6

BTW - it wasn’t this bad not long ago. It’s a recently development as far as I know.

0 Likes

#7

Ah interesting to know you’re maintaining the Emacs package :slight_smile: would you be able to pinpoint in on_text_change of LSP what’s slow? From what I remember it’s supposed to get the change_count of the view and then continue in the worker thread.

0 Likes

#8

Could this have anything to do with one or more packages having enabled the new ST4 API? i.e. that multiple versions of the API are running contemporarily?

Some packages might have been updated to take advantage of ST4 features, including switching to the new API.

0 Likes

#9

So extract LSP and see if I can figure out why it’s slow?

It’s super fast if I am typing in a comment. So it’s clearly when it thinks it has to do something like query the LSP server, whatever it is. Maybe I should figure out what it is…

Yeah it might be the LSP server, which seems to use a CPU second to respond produce a popup. I wonder why it’s so slow.

0 Likes