macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.54k stars 685 forks source link

Ligatures are affecting scroll performance #254

Open samedson opened 8 years ago

samedson commented 8 years ago

I am using the FiraCode font with macligatures set. When scrolling down, MacVim seems to hiccup a bit, but when I scroll up it is very smooth. When I do not set macligatures it scrolls fine (but doesn't show the cool characters). I am testing the scroll speed using both my touchpad and jk keys and my key repeat is set at 1 which is 15ms.

This was originally posted in FiraCode's issues, but the solution to the problem probably lies in improving macligatures support.

OSX 10.11, MacbookPro Retina

Followed the instructions to

set macligatures
set guifont=Fira\ Code:h12

Doing some dumb testing against Activity Monitor, it looks like the CPU load when I scroll down is much lower (~%60) than when I scroll up (150-200%), so the downscrolling seems to be inhibiting the scroll rather than taking on a huge CPU load and causing framerate hiccups.

Looking around for some possibly related topics: Guy with the same issue (Scroll to Amadeus Demarzi) thread related to listchars

jonathanglasmeyer commented 8 years ago

I can confirm this by testing this with Quartz Debug FPS Counter. With Fira Code and no ligatures, scrolling down/up (holding down j/k with high key repeat (defaults write -g KeyRepeat -int 1)) produces 55fps. With ligatures, its consistently produces only 33-35fps.

jordwalke commented 7 years ago

I think the performance wasn't previously this bad. I even see a huge slowdown when I am moving the cursor in regions of the text that have no ligatures, and I am causing no redraws. Build 127.

kejadlen commented 7 years ago

When I'm running MacVim in the Terminal, I'm seeing flickering with macligatures on. Doesn't appear to be a problem w/the GUI version, though.

tammersaleh commented 6 years ago

I'm also seeing this in 8.1.72 (149). I was seeing incredibly slow performance with h/j/k/l movement ~when rendering more than three splits~. I :set nomacligatures and the issues went away.

Strangely, when I hit the top/bottom of the screen while moving the cursor, causing the screen to scroll, everything begins moving at normal speeds. As soon as I move the cursor inside the visible viewport, it's slow again.

(also, this happens whether or not "Use Core Text Renderer" is set)

(Edit: this has nothing to do with splits - same issue in a single window)