utilyre / sentiment.nvim

Enhanced matchparen.vim plugin for Neovim
MIT License
144 stars 1 forks source link

How fast is it? #7

Open nyngwang opened 1 year ago

nyngwang commented 1 year ago

When you said it's blazingly fast, can I make an assumption that it would not cause any problem that the built-in matchparen has when working with ultra-large repo like Linux Kernel source code? That's the main reason I disable built-in matchparen.

Currently, I set the limit to 80 lines to prevent possible lagging in the future. Just curious how large this number can be before things got tricky. Thanks!


On the other hand, I think you might consider submitting a PR upstream if the performance is really good. The built-in matchparen is really bad when working with large repo from my experience. Anyway, thanks for creating this plugin!

utilyre commented 1 year ago

The actual limit is the text visible on the window and the limit option is there just to make sure folds and a small font size won't make any performance issues.

However, this plugin has a little potential on improving the performance (that's why there's a delay option to prevent unneeded calculations). It's currently looking for pairs on each event trigger (e.g. CursorMoved), but it'd be ideal to index the visible portion of the buffer to re-use the already calculated pair positions. But you'll have to wait until I get some free time after graduating from school.

On the other hand, I think you might consider submitting a PR upstream if the performance is really good. The built-in matchparen is really bad when working with large repo from my experience. Anyway, thanks for creating this plugin!

I've barely read the code of matchparen, but according to its help tag it should be pretty fast:

The search is limited to avoid a delay when moving the cursor. The limits are:

  • What is visible in the window.
  • 100 lines above or below the cursor to avoid a long delay when there are closed folds.
  • 'synmaxcol' times 2 bytes before or after the cursor to avoid a delay in a long line with syntax highlighting.
  • A timeout of 300 msec (60 msec in Insert mode). This can be changed with the g:matchparen_timeout and g:matchparen_insert_timeout variables and their buffer-local equivalents b:matchparen_timeout and b:matchparen_insert_timeout.