tcell icon indicating copy to clipboard operation
tcell copied to clipboard

Speed up SetContent by checking length of combining characters before reflect.DeepEqual

Open kivattt opened this issue 1 year ago • 0 comments

Adding these length checks before the reflect.DeepEqual speeds up SetContent when not drawing Unicode combining characters

With xset r rate 300 255 (key repeating 255 times per second), I recorded myself scrolling through 2000 files in my file manager project where I'm using tview with and without (left) this change:

https://github.com/user-attachments/assets/9a4f8f83-7a8d-4b5f-b368-8687c53e1ad3

(6x sped up)

image

I believe the performance difference is a lot less dramatic for most projects, since in this old version of my file manager the screen was always unnecessarily being cleared with Box.DrawForSubclass() in tview

kivattt avatar Jul 26 '24 23:07 kivattt