sublime_text icon indicating copy to clipboard operation
sublime_text copied to clipboard

Performance regression between 4134 and 4136 in Linux

Open mikerogerz opened this issue 3 years ago • 9 comments
trafficstars

Description of the bug

Opening PHP files (in terms of a basic test to repeat the issue) with ~1000 lines of code or more completely hang Sublime Text. Originally, I had a tab open in the editor with one of these problem files, and following the upgrade was unable to open Sublime Text, which resulted in a hanging process.

I've disabled all plugins, and also tested with and without opengl hardware acceleration. I'm on Ubuntu 22.04, under Wayland.

On 4134, files open without issue, and scrolling starts off slightly janky, but smooths out after a while.

Also tested on 4137, and same issue. Had to revert back to 4134 to be able to edit code.

Steps to reproduce

Start Sublime Text, and open a longer PHP file (~1000 lines of code).

Expected behavior

Same performance as 4134.

Actual behavior

Hung UI if opening a new tab with a problem file. If a problem file is already previously opened (saved state), then the process hangs on opening.

Sublime Text build number

4136

Operating system & version

Ubuntu 22.04

(Linux) Desktop environment and/or window manager

Gnome Wayland

Additional information

No response

OpenGL context information

No response

mikerogerz avatar Sep 23 '22 13:09 mikerogerz

Can't reproduce notable performance drops in PHP on Windows.

My benchmark file of about 130k lines of code takes 370ms on ST4134 and 387ms on ST4136 to be fully parsed.

Maybe it's an OS related issue or something being triggered by certain file content - especially if it happens with certain files only. I guess core devs would need such a file to try reproducing.

deathaxe avatar Sep 23 '22 15:09 deathaxe

@mikerogerz does it happen in safe mode?

BenjaminSchaaf avatar Sep 29 '22 08:09 BenjaminSchaaf

@mikerogerz does it happen in safe mode?

It's not happening in safe mode, or at least not to the extent as in normal mode. Even I disabled all plugins, wouldn't that have the same effect? Or are there other specifics I can look for to try to narrow down the issue?

Edit: Running it in normal mode, and disabling the PHP package completely fixes the issue. Re-enabling the PHP package, and the interface hangs again upon opening PHP files, and 4-5 second delays when trying to scroll once the file finally opens.

mikerogerz avatar Oct 13 '22 14:10 mikerogerz

Safe mode basically starts ST with an empty profile. Disabling all plugins should have the same effect in case those are involved. Sometimes ST's syntax cache may get into a weird state. Clearing ~/.cache/sublime-text/Cache may help in such cases.

Can you somehow share a file you face the slowdown with? It could help narrow down the reason. Maybe the reason is caused by a certain kind of content.

deathaxe avatar Oct 13 '22 17:10 deathaxe

Safe mode basically starts ST with an empty profile. Disabling all plugins should have the same effect in case those are involved. Sometimes ST's syntax cache may get into a weird state. Clearing ~/.cache/sublime-text/Cache may help in such cases.

Can you somehow share a file you face the slowdown with? It could help narrow down the reason. Maybe the reason is caused by a certain kind of content.

Thanks for the suggestion @deathaxe but clearing the cache didn't help at all. I can't share the file since it's for a client's closed-source project, but I'll see if I can find something open-source to show the issue. I don't know if it's overly necessary, because it happens with any longer PHP file.. it doesn't seem to be specific to certain content (besides being PHP, with the PHP package enabled).

mikerogerz avatar Oct 13 '22 17:10 mikerogerz

If it's possibly related, I'm on Wayland on Ubuntu 22.04. Laptop is top of the line though, so the hang is definitely a bug.

mikerogerz avatar Oct 13 '22 18:10 mikerogerz

https://github.com/croogo/croogo/blob/master/Core/src/Model/Behavior/LinkedModelBehavior.php

That is an example of a file that hangs the editor for up to 3 seconds while opening the tab with the contents. It's extremely short (47 LOC), but the initial hang is the same as what happens on the other problem files.. although exponentially worse due to length (and some specific syntax?).

mikerogerz avatar Oct 13 '22 19:10 mikerogerz

Must be something os related. All files of the linked repo open instantly on my box.

deathaxe avatar Oct 14 '22 16:10 deathaxe

@deathaxe I agree it might be Wayland related, which is known to have some performance issues. But why would 4134 work perfectly, and suddenly regress in 4136+. That's the part I'm confused about, unless something specifically changed between these versions with respect to syntax.

mikerogerz avatar Oct 14 '22 16:10 mikerogerz

I have also been seeing this issue but I decided to try something to see if it would help. I have intentionally held my copy of Sublime Text to version 4136 until today but before I updated to version 4139 I disabled the PHP package using the command palette. I used my package manager (Sublime's PPA for the dev channel) to update, then enabled the package using the command palette and restarted Sublime Text. After that I haven't had a crash like I have before, but I also don't believe Sublime Text has had to re-index one of my project. I don't know if this means the issue is resolved but I thought it might be some helpful input.

My logic behind disabling the PHP package was that it seems that only PHP projects were having this problem. I was trying to test if I still got crashes when opening a PHP project without the internal PHP packages enabled.

Operating system & version Ubuntu 20.04.5 LTS

(Linux) Desktop environment and/or window manager Budgie:GNOME (X11) 10.5.1-6ubuntu0.2 GNOME 3.36.8

Additional information PHP packages installed: PHP, PHP-Twig

OpenGL context information OpenGL version string: 3.1 Mesa 21.2.6

captbrogers avatar Oct 31 '22 16:10 captbrogers

No syntax definitions have been modified between 4136 and 4139. Hence index isn't updated.

deathaxe avatar Oct 31 '22 19:10 deathaxe

Still exists in 4141. Attempting to scroll down a PHP file completely locks up ST, for up to a few minutes.

Screenshot from 2022-11-10 10-13-32

mikerogerz avatar Nov 10 '22 15:11 mikerogerz

Perhaps this is related to https://github.com/sublimehq/sublime_text/issues/5676?

BenjaminSchaaf avatar Nov 11 '22 00:11 BenjaminSchaaf

Perhaps it is. I'm using build 4141 and was still having issues. Starting in safe mode did seem to resolve the issue so I started to disable themes/plugins. The one that seemed to be the culprit for me was Vue Syntax Highlighting. After removing that package I haven't had issues but I also haven't enabled the material theme I was using because the project was abandoned.

captbrogers avatar Nov 21 '22 16:11 captbrogers

Perhaps it is. I'm using build 4141 and was still having issues. Starting in safe mode did seem to resolve the issue so I started to disable themes/plugins. The one that seemed to be the culprit for me was Vue Syntax Highlighting. After removing that package I haven't had issues but I also haven't enabled the material theme I was using because the project was abandoned.

I tested disabling the Vue Syntax Highlighting package, but the hanging issue still persists.

mikerogerz avatar Nov 21 '22 22:11 mikerogerz

@captbrogers Build 4143 should have fixed #5676. I suggest updating and seeing if it happens there.

BenjaminSchaaf avatar Nov 22 '22 00:11 BenjaminSchaaf

@captbrogers Build 4143 should have fixed #5676. I suggest updating and seeing if it happens there.

I can confirm that the issue is now fixed for me as well in 4143. This issue can be closed. Thanks a lot.

mikerogerz avatar Nov 22 '22 04:11 mikerogerz