Skip to content

Commit d5e4580

Browse files
committed
docs: add perf intro for hlchunk
1 parent 0130f1b commit d5e4580

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,27 @@
66
<p align='center'>
77
<b>English</b> | <a href="./README.zh-CN.md">简体中文</a>
88
</p>
9+
## What can this plugin do
910

10-
## notice!!!
11+
Similar to [indent-blankline](https://github.com/lukas-reineke/indent-blankline.nvim), this plugin can highlight the indent line, and highlight the code chunk according to the current cursor position.
1112

12-
There have been many recent changes. If you encounter any bugs, please feel free to raise an issue. I will improve the code clarity and documentation in the future.
13+
## plugin performance
1314

14-
## What can this plugin do
15+
Using `profile.nvim` for performance analysis, all experiments were conducted on macOS with alacritty, Neovim window height was 66 lines, the code file was `typescript.js`, starting from the first line to the five hundredth line. The average rendering time per render was `0.7ms`.
1516

16-
Similar to [indent-blankline](https://github.com/lukas-reineke/indent-blankline.nvim), this plugin can highlight the indent line, and highlight the code chunk according to the current cursor position.
17+
I did a lot of work to minimize rendering time as much as possible
18+
19+
1. Asynchronous rendering to reduce stuttering
20+
21+
2. Using C functions to speed up some function calls
22+
23+
3. Caching extmarks for each line as much as possible to reduce indentation calculations
24+
25+
4. Using throttle functions to batch the rendering process as much as possible
26+
27+
If you want to reduce the sudden stuttering when scrolling the window, maybe you will like `hlchunk.nvim`~
28+
29+
For detailed optimization work, you can see my blog (written in Chinese): [https://www.shellraining.top/docs/tools/hlchunk/profile.html](https://www.shellraining.top/docs/tools/hlchunk/profile.html)
1730

1831
## Brief introduction
1932

README.zh-CN.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,24 @@
66
<p align='center'>
77
<a href="./README.md">English</a> | <b>简体中文</b>
88
</p>
9+
## 这个插件可以做什么
910

10-
## 注意!!!
11+
[indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) 类似,这个插件可以用来高亮缩进线,并且还可以根据当前光标所处的位置,高亮所在代码块.
1112

12-
最近代码发生了很多变动。如果您遇到任何 bug,请随时提出 issue。我将在未来改进代码清晰度和文档。
13+
## 插件性能
1314

14-
## 这个插件可以做什么
15+
使用 `profile.nvim` 进行性能分析,所有实验均是在 macOS 上的 alacritty 进行,Neovim 窗口高度为 66 行,代码文件是 `typescript.js`,从首行开始,到五百行结束。平均每次渲染耗时 `0.7ms`
1516

16-
[indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) 类似,这个插件可以用来高亮缩进线,并且还可以根据当前光标所处的位置,高亮所在代码块.
17+
我做了很多工作来尽可能缩短渲染耗时
18+
19+
1. 异步渲染,减少卡顿
20+
2. 使用 c 函数,加快部分函数调用
21+
3. 尽可能缓存每行的 extmark,减少缩进计算
22+
4. 使用节流函数来尽可能批处理渲染过程
23+
24+
如果你希望能够减少滚动窗口时候突如其来的卡顿感,也许你会喜欢上 `hlchunk.nvim`~
25+
26+
具体的优化工作你可以看我的博客 [https://www.shellraining.top/docs/tools/hlchunk/profile.html](https://www.shellraining.top/docs/tools/hlchunk/profile.html)
1727

1828
## 简要概述
1929

0 commit comments

Comments
 (0)