kevinhwang91 / nvim-ufo

Not UFO in the sky, but an ultra fold in Neovim.
BSD 3-Clause "New" or "Revised" License
2.18k stars 38 forks source link

[perf] Use frame-key to prevent over-eager drawing of decorations #118

Closed CKolkey closed 1 year ago

CKolkey commented 1 year ago

I was doing some (unrelated) performance profiling and came across some very over eager decorator callbacks. Maybe this has some side-effects that I don't see, but as far as I can tell everything is working just fine, and graphs look a bit better.

before:

Screenshot 2023-03-03 at 21 18 45

after:

Screenshot 2023-03-03 at 21 21 08
kevinhwang91 commented 1 year ago

Thanks for your contribution, but I have struggled with the performance of this part, and finally gave up optimization.

The side-effects of this PR I know: Exec Gzz and open folded lines can't redraw, like opening fold for 347 line: image

AFAIK, ufo's perf is not bad, had you encountered some perf issues?

CKolkey commented 1 year ago

No, I can't say I have any issues with performance. I was mostly just a bit shocked to see the overeagerness of the decoration providers. I tried to recreate the issue you are describing, but it seemed to work fine as far as I can tell. That said, if this isn't a road you want to go down again, no worries, just thought I would mention something :)