Solve Text Editor Sublime 3 Scroll Lag Problem
Introduction
Sublime is my favorite text editor for small projects. I have been using it for more than two years, and I found I like it more over Atom and Visual Studio Code. Recently I installed sublime on my new PC, somehow I found when I try to scroll in Sublime, there will be some initial lag. Human beings are extremely sensitive. I felt really bad about it, and once had even switched to Visual Studio Code.
After doing some Google, taking and improving the answers from the internet, I finally confirmed the source of the problem and solved the problem.
PC Configurations
- Intel Core i9-9900K
- Asus PG27UQ 4K 120Hz
- NVIDIA RTX 2080 TI
- Ubuntu 18.04 LTS
- Sublime 3.1.1 (BUILD 3176)
Phenomenon
In an idle environment, I felt the initial lag when I scroll. In a GPU consuming environment, such as training deep learning models, I felt lag all the time when I scroll. So I suspect it has something to do with GPU rendering. Especially for my 4K 120Hz monitor, I guess even rending for text would take a lot of resources.
Then I went to the NVIDIA X Server Settings, in “PowerMizer” tab, the default mode is “Auto”, the Graphics Clock is around 300-400 MHz, and Memory Transfer Rate is around 800 MHz. But whenever I scroll, I would see the Graphics Clock boosted to 1350 MHz and Memory Transfer Rate to 14000 MHz.
Solution
In “PowerMizer Settings”, change the Preferred Mode to “Prefer Maximum Performance”. This will increase and lock the Graphics Clock to 1350 MHz and Memory Transfer Rate to 14000 MHz. I was afraid that this will increase power consumption and make the PC super hot. But nvidia-smi
told me that the power was only increased from 30 Walt to 60 Walt and the GPU temperature was increased 2 to 3 degrees, which is quite acceptable. After setting to the maximum performance, there is no lag anymore when I scroll.
Final Remarks
There might be still some problems to scroll in Sublime 3 when GPU is utilized 100% such as during deep learning model training. However, I tested Visual Studio Code during deep learning model training, and there is no such scroll lag problem. Therefore, it is Sublime’s internal implementation issues. I later found from their GitHub that the author has changed the usage of graphic APIs in the development version of Sublime 3 trying to improve the rendering efficiency using GPU. I am looking forward to the next stable release!
Solve Text Editor Sublime 3 Scroll Lag Problem
https://leimao.github.io/blog/Solve-Sublime-Scroll-Lag-Problem/