Sublime Forum

Sublime Text 4 is very laggy and slow while typing after installing some plugins which worked perfectly in Sublime text 3

#1

I have only one package in sublime text for autocompletion because I think I want a clean editor with minimum modifications, so I installed Tabnine.
But to my disappointment it made sublime text horribly slow each keystroke appeared after a delay of about 4-5 seconds.
I thought the package/plugin had some issues so I tried to switch to some other AI autocompletion tool but that didn’t work well,
I tried Codeium but it was giving suggestions which were messed up, there were two print statements in one, it kept on giving messy solutions again and again and on top of that whenever I opened up sublime 4, a terminal window would open which was a language server .download file which never downloaded properly.

I was fed up …
I tried Sublime Text 3 for no reason but to my surprise Tabnine and Codeium and all other plugins worked perfectly, smooth as butter …

I have pretty decent specs on my laptop so I don’t think it’s some specs problem.

Maybe the new interface or UI of Sublime Text 4 might be interfering with the plugins processing…

I need to use Sublime Text 4 for latest features and I love it’s UI…

Anyone has any solutions to this though I have tried many times myself, I am open to suggestions…

0 Likes

#2

Such behavior normally indicates a plugin running expensive code or such with high latencies in UI thread.

Different behavior between ST3 and 4 may be caused by shipping different versions of a plugin. Several packages dropped support for ST3 and therefore ship older versions. A regression may have been introduced in a more recent release available on ST4, only.

That’s most likely something the plugin author needs to investigate and fix.

0 Likes

#3

I checked the versions of the plugins they were the same for both ST3 and ST4…

0 Likes

#4

Is there any chance I could do something else in ST4 like changing some settings or something …

0 Likes

#5

Without knowledga about the reason, it’s hard to advice anything.

A first step therefore probably was to investigate, which event handler consumes so much time by running Main > Tools > Developer > Profile Plugins.

The result page lists all events and plugins which reacted handled them. Look for a plugin causing high “mean” times to find the culprit.

Probably on_query_completions is involved.

Writing performance may be tanked by plugins, which add huge amounts of completion items. The way legacy completion data structures are converted to new sublime.CompletionItem classes in ST4 may cause a performance drop in that case. Latest dev builds ship a fix which should improve situation, but finally plugins need to directly create completion items using new data classes to avoid additional conversion steps.

0 Likes

#6

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

on_activated:
Default.history_list: 0.000s total, mean: 0.000s, max: 0.000s
Tabnine.completions.completions_v3: 0.000s total, mean: 0.000s, max: 0.000s
Vintage.vintage: 0.000s total, mean: 0.000s, max: 0.000s

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

on_hover:
Default.symbol: 0.000s total, mean: 0.000s, max: 0.000s

on_modified:
Default.history_list: 0.000s total, mean: 0.000s, max: 0.000s

on_post_text_command:
Default.history_list: 0.000s total, mean: 0.000s, max: 0.000s
Default.paste_from_history: 0.000s total, mean: 0.000s, max: 0.000s
Tabnine.completions.completions_v3: 0.000s total, mean: 0.000s, max: 0.000s

on_query_completions:
CSS.css_completions: 0.000s total, mean: 0.000s, max: 0.000s
HTML.html_completions: 0.000s total, mean: 0.000s, max: 0.000s
Tabnine.completions.completions_v3: 11.616s total, mean: 0.375s, max: 1.846s

on_query_context:
Default.block: 0.000s total, mean: 0.000s, max: 0.000s
Vintage.vintage: 0.000s total, mean: 0.000s, max: 0.000s

on_selection_modified:
Default.history_list: 0.016s total, mean: 0.000s, max: 0.016s
Vintage.vintage: 0.000s total, mean: 0.000s, max: 0.000s

on_text_command:
Default.history_list: 0.000s total, mean: 0.000s, max: 0.000s
Tabnine.completions.completions_v3: 0.000s total, mean: 0.000s, max: 0.000s

on_window_command:
Default.history_list: 0.000s total, mean: 0.000s, max: 0.000s

0 Likes

#7

This is what I got… I can see Tabnine’s autocompletion took around 1.846s which is I guess too much for a fast editor like Sublime…
I checked the same in ST3, the max, mean, total time there was less than this…

0 Likes

#8

Seems to be a known issue, according to

ST4 provides API endpoints for plugins to provide completions asynchronously, which would help reducing/avoiding UI to block while waiting for network responses, but Tabnine doesn’t seem to make use of them.

0 Likes

#9

That means there’s nothing that I can do …

0 Likes