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

Improve history paging performance #1905

Merged
merged 2 commits into from
Oct 29, 2023

Conversation

H3rnand3zzz
Copy link
Contributor

@H3rnand3zzz H3rnand3zzz commented Oct 29, 2023

  • No need for valgrind

How to test the functionality

  • Reach bottom and top of your conversations, you should see that (1) delay on page switching has been reduced and (2) that you can reach first and last message in the chat (though there already is unrelated bug, that's why, please, make sure that you can see first message without the update).
  • Check whether MAM is working
  • Use page up 10-20 times (to fill the buffer) and then page down until you see last messages. Then hold/click quickly page down. Lag should be much less noticeable than before changes were introduced.

Currently buffer is being redrawn on each DB fetch,
this causes a big waste of resources as on every page_up button click
we redraw 1200 messages (each message can be longer than 1 line),
commit will reduce buffer size to 200,
thus reducing amount of messages redrawn on each page up,
this is a temporary solution for a bigger problem.
Stop fetching message from DB when profanity reached start or end of the history
with the user. This allows to save resources on page up/down
when ceiling or bottom accordingly are reached.
@jubalh jubalh requested review from sjaeckel and jubalh October 29, 2023 17:58
@jubalh jubalh added this to the next milestone Oct 29, 2023
@MarcoPolo-PasTonMolo
Copy link
Collaborator

LGTM

@jubalh jubalh merged commit e609b70 into profanity-im:master Oct 29, 2023
6 checks passed
@jubalh
Copy link
Member

jubalh commented Oct 29, 2023

Thanks!

@H3rnand3zzz H3rnand3zzz deleted the fix/history-lag branch November 6, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants