Sublime Forum

Slow performance with LSP and clangd

#1

Hi,

great piece of software, congrats. Still, I’ve noticed after updating to ST4 that, although greatly improved in usability, the LSP plugin actually increases latency a lot when typing and scrolling in modestly complex C++ files.

Few details I consider relevant: MacOS 11.4, external 4K display, ST 4113, clangd 12.0.0, hardware_acceleration=opengl

I hope his helps.

0 Likes

#2

As in rendering performance?

0 Likes

#3

I’d say it feels like semantic popups (completion, symbol information, etc) are blocking the GUI too much. Queries to clangd in complex C++ projects (e.g. using Boost) can take long, up to hundred of milliseconds I’ve noticed in the diagnostics pane, but those should be asynchronous and not halt user interface, right?

0 Likes

#4

All operations are asynchronous and don’t block the UI.

Can you try to reproduce the slowness and then click on Tools > Developer > Profile Plugins and paste the output here?

0 Likes

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

on_activated:
Default.history_list: 0.007s total, mean: 0.000s, max: 0.001s
Git.git.ignore: 0.002s total, mean: 0.000s, max: 0.000s
Git.git.statusbar: 0.908s total, mean: 0.018s, max: 0.334s
Vintage.vintage: 0.001s total, mean: 0.000s, max: 0.000s

on_close:
Git.git.commit: 0.000s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.000s total, mean: 0.000s, max: 0.000s
LaTeXTools.latextools_cache_listener: 0.000s total, mean: 0.000s, max: 0.000s

on_deactivated:
Vintage.vintage: 0.005s total, mean: 0.000s, max: 0.000s

on_hover:
Default.symbol: 0.001s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.001s total, mean: 0.000s, max: 0.000s
LaTeXTools.st_preview.preview_image: 0.000s total, mean: 0.000s, max: 0.000s
Terminus.terminus.mouse: 0.000s total, mean: 0.000s, max: 0.000s

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

on_load:
Default.exec: 0.002s total, mean: 0.000s, max: 0.001s
FileManager.FileManager: 0.000s total, mean: 0.000s, max: 0.000s
Git.git.annotate: 0.000s total, mean: 0.000s, max: 0.000s
LSP.boot: 0.000s total, mean: 0.000s, max: 0.000s
LaTeXTools.biblatex_syntax_listener: 0.000s total, mean: 0.000s, max: 0.000s
LaTeXTools.latex_cwl_completions: 0.001s total, mean: 0.000s, max: 0.001s
LaTeXTools.makePDF: 0.001s total, mean: 0.000s, max: 0.000s
LaTeXTools.texSyntaxListener: 0.000s total, mean: 0.000s, max: 0.000s
Vintage.vintage: 0.000s total, mean: 0.000s, max: 0.000s

on_modified:
Default.history_list: 0.007s total, mean: 0.000s, max: 0.000s
Git.git.annotate: 0.004s total, mean: 0.000s, max: 0.000s
LaTeXTools.st_preview.preview_math: 0.000s total, mean: 0.000s, max: 0.000s
Terminus.terminus.commands: 0.001s total, mean: 0.000s, max: 0.000s

on_new:
Vintage.vintage: 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:
Git.git.ignore: 0.000s total, mean: 0.000s, max: 0.000s
Git.git.statusbar: 0.003s total, mean: 0.000s, max: 0.001s
LaTeXTools.biblatex_syntax_listener: 0.001s total, mean: 0.000s, max: 0.000s
LaTeXTools.detect_spellcheck: 0.000s total, mean: 0.000s, max: 0.000s
LaTeXTools.texSyntaxListener: 0.001s total, mean: 0.000s, max: 0.000s

on_post_text_command:
Default.history_list: 0.005s total, mean: 0.000s, max: 0.000s
Default.paste_from_history: 0.002s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.003s total, mean: 0.000s, max: 0.000s
Terminus.terminus.clipboard: 0.007s total, mean: 0.000s, max: 0.000s
Terminus.terminus.commands: 0.003s total, mean: 0.000s, max: 0.000s

on_post_window_command:
    LSP.boot: 0.000s 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
    Terminus.terminus.commands: 0.000s total, mean: 0.000s, max: 0.000s

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

on_pre_save:
    Vintage.vintage: 0.000s total, mean: 0.000s, max: 0.000s

on_query_completions:
    CSS.css_completions: 0.002s total, mean: 0.000s, max: 0.000s
    HTML.html_completions: 0.001s total, mean: 0.000s, max: 0.000s
    LSP.plugin.documents: 0.001s total, mean: 0.000s, max: 0.000s
    LaTeXTools.biblatex_crossref_completions: 0.001s total, mean: 0.000s, max: 0.000s
    LaTeXTools.biblatex_field_name_completions: 0.000s total, mean: 0.000s, max: 0.000s
    LaTeXTools.biblatex_name_completions: 0.000s total, mean: 0.000s, max: 0.000s
    LaTeXTools.biblatex_snippet_completions: 0.000s total, mean: 0.000s, max: 0.000s
    LaTeXTools.latex_cwl_completions: 0.000s total, mean: 0.000s, max: 0.000s
    LaTeXTools.latex_directive_completions: 0.000s total, mean: 0.000s, max: 0.000s
    LaTeXTools.latex_fill_all: 0.000s total, mean: 0.000s, max: 0.000s

on_query_context:
    Default.block: 0.002s total, mean: 0.000s, max: 0.000s
    LSP.plugin.documents: 0.006s total, mean: 0.000s, max: 0.000s
    LaTeXTools.latex_fill_all: 0.002s total, mean: 0.000s, max: 0.000s
    LaTeXTools.latextools_sublime_version_listener: 0.001s total, mean: 0.000s, max: 0.000s
    LaTeXTools.toc_quickpanel: 0.001s total, mean: 0.000s, max: 0.000s
    Terminus.terminus.query: 0.024s total, mean: 0.000s, max: 0.002s
    Vintage.vintage: 0.002s total, mean: 0.000s, max: 0.000s
    package_setting_context.all.package_setting_context: 0.005s total, mean: 0.000s, max: 0.000s

on_selection_modified:
    Default.history_list: 0.060s total, mean: 0.000s, max: 0.000s
    LaTeXTools.st_preview.preview_image: 0.001s total, mean: 0.000s, max: 0.000s
    LaTeXTools.st_preview.preview_math: 0.001s total, mean: 0.000s, max: 0.000s
    Terminus.terminus.commands: 0.002s total, mean: 0.000s, max: 0.000s
    Vintage.vintage: 0.009s total, mean: 0.000s, max: 0.000s

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

on_text_command:
    Default.history_list: 0.015s total, mean: 0.000s, max: 0.000s
    FileManager.FileManager: 0.001s total, mean: 0.000s, max: 0.000s
    Terminus.terminus.commands: 0.008s total, mean: 0.000s, max: 0.000s
    Terminus.terminus.mouse: 0.002s total, mean: 0.000s, max: 0.000s

on_window_command:
    Default.history_list: 0.001s total, mean: 0.000s, max: 0.000s
    LSP.plugin.core.panels: 0.000s total, mean: 0.000s, max: 0.000s
    Terminus.terminus.commands: 0.000s total, mean: 0.000s, max: 0.000s
0 Likes

#6

That doesn’t look bad to me. Can you open the console with View > Show Console and run

sublime.log_fps()

in that console? Then reproduce the slowness and observe whether the frame times are becoming too large.

0 Likes

#8

Sorry I just realised more information needed to be gathered in order to have a significative dump. Here’s a new one after some more intense coding:

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

on_activated:
Default.history_list: 0.028s total, mean: 0.000s, max: 0.003s
Git.git.ignore: 0.005s total, mean: 0.000s, max: 0.000s
Git.git.statusbar: 1.026s total, mean: 0.006s, max: 0.334s
Vintage.vintage: 0.006s total, mean: 0.000s, max: 0.001s

on_close:
Default.settings: 0.001s total, mean: 0.000s, max: 0.000s
Git.git.commit: 0.001s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.000s total, mean: 0.000s, max: 0.000s
LaTeXTools.latextools_cache_listener: 0.000s total, mean: 0.000s, max: 0.000s

on_deactivated:
Vintage.vintage: 0.017s total, mean: 0.000s, max: 0.000s

on_hover:
Default.symbol: 0.008s total, mean: 0.000s, max: 0.003s
LSP.plugin.documents: 0.010s total, mean: 0.000s, max: 0.000s
LaTeXTools.st_preview.preview_image: 0.003s total, mean: 0.000s, max: 0.000s
Terminus.terminus.mouse: 0.001s total, mean: 0.000s, max: 0.000s

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

on_load:
Default.exec: 0.004s total, mean: 0.000s, max: 0.001s
FileManager.FileManager: 0.000s total, mean: 0.000s, max: 0.000s
Git.git.annotate: 0.000s total, mean: 0.000s, max: 0.000s
LSP.boot: 0.000s total, mean: 0.000s, max: 0.000s
LaTeXTools.biblatex_syntax_listener: 0.001s total, mean: 0.000s, max: 0.000s
LaTeXTools.latex_cwl_completions: 0.001s total, mean: 0.000s, max: 0.001s
LaTeXTools.makePDF: 0.001s total, mean: 0.000s, max: 0.000s
LaTeXTools.texSyntaxListener: 0.001s total, mean: 0.000s, max: 0.000s
Vintage.vintage: 0.001s total, mean: 0.000s, max: 0.000s

on_modified:
Default.history_list: 0.117s total, mean: 0.000s, max: 0.001s
Default.settings: 0.000s total, mean: 0.000s, max: 0.000s
Git.git.annotate: 0.054s total, mean: 0.000s, max: 0.001s
LaTeXTools.st_preview.preview_math: 0.000s total, mean: 0.000s, max: 0.000s
Terminus.terminus.commands: 0.011s total, mean: 0.000s, max: 0.000s

on_new:
Vintage.vintage: 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:
Git.git.ignore: 0.001s total, mean: 0.000s, max: 0.000s
Git.git.statusbar: 0.011s total, mean: 0.000s, max: 0.001s
LaTeXTools.biblatex_syntax_listener: 0.005s total, mean: 0.000s, max: 0.000s
LaTeXTools.detect_spellcheck: 0.001s total, mean: 0.000s, max: 0.000s
LaTeXTools.texSyntaxListener: 0.005s total, mean: 0.000s, max: 0.000s

on_post_text_command:
Default.history_list: 0.023s total, mean: 0.000s, max: 0.000s
Default.paste_from_history: 0.014s total, mean: 0.000s, max: 0.003s
LSP.plugin.documents: 0.013s total, mean: 0.000s, max: 0.000s
Terminus.terminus.clipboard: 0.032s total, mean: 0.000s, max: 0.001s
Terminus.terminus.commands: 0.014s total, mean: 0.000s, max: 0.002s

on_post_window_command:
LSP.boot: 0.003s total, mean: 0.000s, max: 0.000s

on_pre_close:
Default.history_list: 0.003s total, mean: 0.000s, max: 0.000s
Default.settings: 0.000s total, mean: 0.000s, max: 0.000s
LSP.boot: 0.001s total, mean: 0.000s, max: 0.000s
Terminus.terminus.commands: 0.000s total, mean: 0.000s, max: 0.000s

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

on_pre_save:
Vintage.vintage: 0.001s total, mean: 0.000s, max: 0.000s

on_query_completions:
CSS.css_completions: 0.041s total, mean: 0.000s, max: 0.001s
HTML.html_completions: 0.021s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.031s total, mean: 0.000s, max: 0.000s
LaTeXTools.biblatex_crossref_completions: 0.021s total, mean: 0.000s, max: 0.000s
LaTeXTools.biblatex_field_name_completions: 0.007s total, mean: 0.000s, max: 0.000s
LaTeXTools.biblatex_name_completions: 0.006s total, mean: 0.000s, max: 0.000s
LaTeXTools.biblatex_snippet_completions: 0.005s total, mean: 0.000s, max: 0.001s
LaTeXTools.latex_cwl_completions: 0.002s total, mean: 0.000s, max: 0.000s
LaTeXTools.latex_directive_completions: 0.007s total, mean: 0.000s, max: 0.000s
LaTeXTools.latex_fill_all: 0.003s total, mean: 0.000s, max: 0.000s

on_query_context:
Default.block: 0.012s total, mean: 0.000s, max: 0.000s
LSP.plugin.documents: 0.019s total, mean: 0.000s, max: 0.000s
LaTeXTools.latex_fill_all: 0.012s total, mean: 0.000s, max: 0.000s
LaTeXTools.latextools_sublime_version_listener: 0.005s total, mean: 0.000s, max: 0.000s
LaTeXTools.toc_quickpanel: 0.005s total, mean: 0.000s, max: 0.000s
Terminus.terminus.query: 0.169s total, mean: 0.000s, max: 0.012s
Vintage.vintage: 0.010s total, mean: 0.000s, max: 0.000s
package_setting_context.all.package_setting_context: 0.023s total, mean: 0.000s, max: 0.000s

on_selection_modified:
Default.history_list: 0.343s total, mean: 0.000s, max: 0.001s
LaTeXTools.st_preview.preview_image: 0.001s total, mean: 0.000s, max: 0.000s
LaTeXTools.st_preview.preview_math: 0.001s total, mean: 0.000s, max: 0.000s
Terminus.terminus.commands: 0.013s total, mean: 0.000s, max: 0.000s
Vintage.vintage: 0.061s total, mean: 0.000s, max: 0.001s

on_text_changed:
LSP.plugin.documents: 0.120s total, mean: 0.000s, max: 0.009s

on_text_command:
Default.history_list: 0.071s total, mean: 0.000s, max: 0.001s
FileManager.FileManager: 0.004s total, mean: 0.000s, max: 0.000s
Terminus.terminus.commands: 0.036s total, mean: 0.000s, max: 0.000s
Terminus.terminus.mouse: 0.010s total, mean: 0.000s, max: 0.000s

on_window_command:
Default.history_list: 0.007s total, mean: 0.000s, max: 0.000s
LSP.plugin.core.panels: 0.001s total, mean: 0.000s, max: 0.000s
Terminus.terminus.commands: 0.001s total, mean: 0.000s, max: 0.000s

0 Likes

#9

Okay. The ones that jump out to me are:

  1. Terminus for querying keybindings (on_query_context)
  2. LSP for on text changed events
  3. Default.history_list for selection change events and for checking text commands
0 Likes

#10

On the other hand the means and max values are all near zero. Except for this Git.git.statusbar on activated event which has a 300ms max.

0 Likes

#11

Thanks, I guess I will have to spend some more time disabling/enabling plugins, in order to exactly pinpoint where performance is hurt.

Are there any known bugs for MacOS performance in the latest release?

0 Likes