Skip to content

Conversation

@jmartinesp
Copy link
Contributor

@jmartinesp jmartinesp commented Nov 4, 2025

This should slightly improve the performance for loading timeline items since we might skip loading the sender profiles for some/most items.

In my local tests on Android, this can save up to 50ms for each timeline initialization, although the benchmark only shows a 1.7% improvement 🥲 . That said, it also says the the function that populates the cache is not called when it definitely is,
so it doesn't seem too reliable.

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.54%. Comparing base (781df55) to head (04902ac).
⚠️ Report is 23 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...dk-ui/src/timeline/controller/state_transaction.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5827   +/-   ##
=======================================
  Coverage   88.54%   88.54%           
=======================================
  Files         361      361           
  Lines      101421   101434   +13     
  Branches   101421   101434   +13     
=======================================
+ Hits        89803    89818   +15     
+ Misses       7410     7409    -1     
+ Partials     4208     4207    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 4, 2025

CodSpeed Performance Report

Merging #5827 will not alter performance

Comparing refactor/add-profiles-cache-to-handle-remote-event (04902ac) with main (781df55)

Summary

✅ 50 untouched

@jmartinesp jmartinesp marked this pull request as ready for review November 4, 2025 15:32
@jmartinesp jmartinesp requested a review from a team as a code owner November 4, 2025 15:32
@jmartinesp jmartinesp requested review from Hywan and removed request for a team November 4, 2025 15:32
Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!
How do you manage the user profile invalidation? If a user has updated its profile, how is it updated from the cache (the HashMap)?

@jmartinesp
Copy link
Contributor Author

jmartinesp commented Nov 5, 2025

That's the neat part, you don't! Jokes aside, when I discussed it with @poljar (and I think I confirmed it by looking at the code), by the time we reach this part of the flow we'd have already applied any changes caused by the state events, including the room member ones, so it should be fine to not invalidate the cache, since it'll be used just for the current vector diffs.

I may be wrong though.

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

The cache is local to handle_remote_events_with_diffs. I think it's correct. Let's go :-].

@jmartinesp jmartinesp merged commit 8b805b1 into main Nov 7, 2025
60 checks passed
@jmartinesp jmartinesp deleted the refactor/add-profiles-cache-to-handle-remote-event branch November 7, 2025 09:42
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