qstrahl / vim-matchmaker

Highlight matches for the word under the cursor
38 stars 10 forks source link

Improve Performance #16

Open xanderdunn opened 9 years ago

xanderdunn commented 9 years ago

Matchmaker causes quite a performance drain when I'm navigating large source files.

See this screen recording where just navigating up and down lines of code if very slow and laborious with Matchmaker turned on, but very fast and smooth with Matchmaker turned off.

I'd like to keep Matchmaker always turned on, like most GUI IDEs. However, doing so is too much of a performance drain right now. How about not triggering Matchmaker until the cursor has come to rest? This is the behavior in Xcode.

qstrahl commented 9 years ago

I'll look into that possibility, but it all comes down to whether or not Vim supports that behaviour. I don't think it does. I'm not aware of any autocmd that triggers after the cursor stops moving, and I don't think vim can register a tick function or anything like that.

On Fri, 2 Jan 2015 23:16 Alex Dunn notifications@github.com wrote:

Matchmaker causes quite a performance drain when I'm navigating large source files.

See this screen recording https://github.com/alexdunn/storage/raw/master/matchmaker_performance.mov where just navigating up and down lines of code if very slow and laborious with Matchmaker turned on, but very fast and smooth with Matchmaker turned off.

I'd like to keep Matchmaker always turned on, like most GUI IDEs. However, doing so is too much of a performance drain right now. How about not triggering Matchmaker until the cursor has come to rest? This is the behavior in Xcode.

— Reply to this email directly or view it on GitHub https://github.com/qstrahl/vim-matchmaker/issues/16.

xanderdunn commented 9 years ago

I haven't written a vim plugin, but what about doing it asynchronously?

When the matchmaker plugin receives the call that the cursor has moved, wait for a given period of time. Maybe 1 second. If matchmaker doesn't receive another cursor moved call within that time period, then tell vim to do the highlighting.

qstrahl commented 9 years ago

Vim doesn't do asynchronous. At least not without some severe python hackery, and even then I've never seen it end without trouble, and wouldn't know where to begin anyway.

On Sat, 3 Jan 2015 02:48 Alex Dunn notifications@github.com wrote:

I haven't written a vim plugin, but what about doing it asynchronously?

When the matchmaker plugin receives the call that the cursor has moved, wait for a given period of time. Maybe 1 second. If matchmaker doesn't receive another cursor moved call within that time period, then tell vim to do the highlighting.

— Reply to this email directly or view it on GitHub https://github.com/qstrahl/vim-matchmaker/issues/16#issuecomment-68586730 .

tommcdo commented 9 years ago

What about CursorHold?

On Sat, Jan 3, 2015, 2:54 AM Quinn Strahl notifications@github.com wrote:

Vim doesn't do asynchronous. At least not without some severe python hackery, and even then I've never seen it end without trouble, and wouldn't know where to begin anyway.

On Sat, 3 Jan 2015 02:48 Alex Dunn notifications@github.com wrote:

I haven't written a vim plugin, but what about doing it asynchronously?

When the matchmaker plugin receives the call that the cursor has moved, wait for a given period of time. Maybe 1 second. If matchmaker doesn't receive another cursor moved call within that time period, then tell vim to do the highlighting.

— Reply to this email directly or view it on GitHub < https://github.com/qstrahl/vim-matchmaker/issues/16#issuecomment-68586730>

.

— Reply to this email directly or view it on GitHub https://github.com/qstrahl/vim-matchmaker/issues/16#issuecomment-68586866 .

qstrahl commented 9 years ago

That'll probably do it. I forgot about that. =P

On Sat, 3 Jan 2015 07:48 Tom McDonald notifications@github.com wrote:

What about CursorHold?

On Sat, Jan 3, 2015, 2:54 AM Quinn Strahl notifications@github.com wrote:

Vim doesn't do asynchronous. At least not without some severe python hackery, and even then I've never seen it end without trouble, and wouldn't know where to begin anyway.

On Sat, 3 Jan 2015 02:48 Alex Dunn notifications@github.com wrote:

I haven't written a vim plugin, but what about doing it asynchronously?

When the matchmaker plugin receives the call that the cursor has moved, wait for a given period of time. Maybe 1 second. If matchmaker doesn't receive another cursor moved call within that time period, then tell vim to do the highlighting.

— Reply to this email directly or view it on GitHub <

https://github.com/qstrahl/vim-matchmaker/issues/16#issuecomment-68586730>

.

— Reply to this email directly or view it on GitHub < https://github.com/qstrahl/vim-matchmaker/issues/16#issuecomment-68586866>

.

— Reply to this email directly or view it on GitHub https://github.com/qstrahl/vim-matchmaker/issues/16#issuecomment-68593955 .