guillermooo / Vintageous

Vi/Vim emulation for Sublime Text 3
http://guillermooo.bitbucket.org/Vintageous/
Other
1.64k stars 115 forks source link

Optimize gj & gk motions #762

Open albertxing opened 9 years ago

albertxing commented 9 years ago

Currently gj and gk are implemented in a very inefficient manner (i.e. it will often lag during normal use).

Sublime's Vintage mode maps j to gj and k to gk by default, and it doesn't exhibit slow performance.

--- Want to back this issue? **[Place a bounty on it!](https://www.bountysource.com/issues/5155779-optimize-gj-gk-motions?utm_campaign=plugin&utm_content=tracker%2F204305&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F204305&utm_medium=issues&utm_source=github).
guillermooo commented 9 years ago

Can you please indicate repro steps and platform details?

albertxing commented 9 years ago

In .vintageousrc I use

:map j gj
:map k gk

On larger files and especially on my slower machine, Sublime will stutter and lag when j is pressed continuously.

I'm on Windows 8.1.

guillermooo commented 9 years ago

IIRC, Vintageous uses native ST commands for this. In fact, I had to reimplement j and k so they were faster than their native version. Can you confirm you don't see this lag in plain ST or Vintage under the same circumstances?

guillermooo commented 9 years ago

Can you also please define 'large file' so that I can try and repro this?

guillermooo commented 9 years ago

Also, for my reference, the API doesn't allow such granular control as to replicate gk and gj without resorting to using native commands.

albertxing commented 9 years ago

I think the problem only exists on slower machines (e.g. without enough graphics power). By large file I mean roughly >500 lines.

In general this is something that I have failed to constantly reproduce on my laptop (with integrated graphics), and have not yet thoroughly tested this on various older machines. If possible, try finding a machine with no discreet or integrated graphics (i.e. a Core 2 processor).

However the lag is significant enough when it does appear to be a cause of concern, hence the issue.

albertxing commented 9 years ago

I do recall, however, testing out the built-in Vintage on a machine that was lagging considerably with Vintageous, and Vintage mode worked more or less okay.