Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
eero-lehtinen authored Nov 14, 2024
1 parent 1c4cfa9 commit 5c5167a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ The patterns should contain two empty groups `()` to designate the replacement r

I don't like how an insignificant feature like color highlighting can hog CPU resources and cause lag, so this plugin tries to make it fast and unnoticeable. The highlighting is done on a timer after edits to give the immediate CPU time to features you actually care about like Treesitter or LSP. Then after the timer delay has passed, the colors are searched and highlights applied. You can also set the delay to 0 to make highlighting instant.

When you open a new buffer or scroll the view, a whole screen update is done. With my AMD Ryzen 7 5800X3D, this takes around 0.3 ms on a 65 rows by 120 cols window, full of text and 10 hex colors. In [the stress test file](./stress_test.txt), where the window is filled with ~1000 hex colors, the initial update takes 4 ms, more than half of which is unavoidable Nvim extmark (highlight) creation and assignment overhead. This plugin caches lines, so unchanged lines take almost no time to process. This results in a full screen update taking about 0.01 ms when scrolling back and forth on the same lines.
When you open a new buffer or scroll the view, visible lines are processed. With my AMD Ryzen 7 5800X3D, this takes around 0.3 ms on a 65 rows by 120 cols window, full of text and 10 hex colors. In [the stress test file](./stress_test.txt), where the window is filled with ~1000 hex colors, the initial update takes 4 ms, more than half of which is unavoidable Nvim extmark (highlight) creation and assignment overhead. This plugin caches lines, so unchanged lines take almost no time to process. This results in a full screen update taking about 0.01 ms when scrolling back and forth on the same lines.

When editing, only the changed lines are updated. In the common case, when inserting on a line with no colors, the update takes < 0.01 ms (line being 120 chars wide). Doing the same in the stress test file takes < 0.1 ms. Of course with async, it takes zero time immediately after inserting text.

Expand Down

0 comments on commit 5c5167a

Please sign in to comment.