Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid screen refreshes #34

Closed
walles opened this issue Jan 11, 2021 · 0 comments
Closed

Avoid screen refreshes #34

walles opened this issue Jan 11, 2021 · 0 comments
Labels
upstream Must be fixed in some dependency

Comments

@walles
Copy link
Owner

walles commented Jan 11, 2021

Using this: gdamore/tcell#422

I did some profiling, and my terminal app is maxing out the CPU while I'm scrolling.

If I could not update the screen when there are pending events, that would improve things. I have experimented and it was nice!

Ref:

moar/m/pager.go

Lines 781 to 782 in db4acb5

// FIXME: If more events are ready, skip this redraw, that
// should speed up mouse wheel scrolling

@walles walles added the upstream Must be fixed in some dependency label Jan 11, 2021
walles added a commit that referenced this issue Apr 15, 2021
Fixes #37 and fixes #34.
walles added a commit that referenced this issue Apr 16, 2021
Fixes #37 and fixes #34.
walles added a commit that referenced this issue Apr 16, 2021
Fixes #37 and fixes #34.
walles added a commit that referenced this issue Apr 18, 2021
* Fixes #37
* Fixes #34
* Replaces #44
* Makes window resizing smoother.

Before this change, the main loop was roughly:
* Await one single user input event
* Handle single user input event
* Redraw screen

With this change in place, the main loop is:
* Await one single user input event (like before)
* Handle single user input event (like before)
* If there are no more events, redraw screen (new!)

The difference is huge if you do a fling scroll on a trackpad. Before,
scrolling was slow at constant speed, and the scrolling kept on at that
slow constant speed way longer than what it should have. Now, scrolling
feels just like it should.
@walles walles closed this as completed in 44a064c Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Must be fixed in some dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant