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

perf: reduce repaints amount caused by selection #4889

Merged
merged 8 commits into from
Oct 13, 2023

Conversation

kornes
Copy link
Contributor

@kornes kornes commented Oct 11, 2023

PR reduces amount of painting while not changing behavior/visuals of text selection

  • removed selecting_ bool, only used by triple click selection, which forced layout on each click release.
  • fixed broken SelectionItem != operator which worked like ==, only used by already removed selecting_ so no side effects
  • moved triple click selection due to above changes
  • changed ChannelView::setSelection to repaint/emit signal only if selection was updated

tested:

  • all consumers of selectionChanged signal
  • single / double / triple click selection

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/widgets/helper/ChannelView.cpp Show resolved Hide resolved
Copy link
Contributor

@Nerixyz Nerixyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the segfault, this PR works for me. You really notice the absence of re-layouts when selecting in debug builds 👍.

Nit: This PR reduces the amount of (re-)layouts performed when selecting, the widget is still repainted (about) 50 times per second.

src/widgets/helper/ChannelView.cpp Show resolved Hide resolved
src/messages/Selection.hpp Show resolved Hide resolved
@pajlada pajlada changed the title Ref: reduce repaints amount caused by selection perf: reduce repaints amount caused by selection Oct 13, 2023
@pajlada pajlada enabled auto-merge (squash) October 13, 2023 17:10
@pajlada pajlada merged commit ccaedc3 into Chatterino:master Oct 13, 2023
15 checks passed
@kornes kornes deleted the ref_selection-repaints branch October 13, 2023 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants