Skip to content

chore: offload conversation calculation - WPB-17293#2921

Merged
dmitrysimkin merged 34 commits intodevelopfrom
chore/offload-conversation-calculation
May 6, 2025
Merged

chore: offload conversation calculation - WPB-17293#2921
dmitrysimkin merged 34 commits intodevelopfrom
chore/offload-conversation-calculation

Conversation

@dmitrysimkin
Copy link
Copy Markdown
Contributor

@dmitrysimkin dmitrysimkin commented Apr 21, 2025

Issue

Attempt to improve conversation screen performance issues
What was done:

  • offload calculations of a sections to background thread. In order to do that I refetch messages in background thread, make calculations and re-set main thread selfUser and messages back to section controller
  • Also made sectionControllers and actionControllers thread safe dictionary to synchronise access from 2 threads
  • Added leading and trailing debounce for changes from DB, sometimes the are a lot of updates comes and we spam with them UI as well. Debounce limits amount of UI updates
  • Removed nonPersistenceObjectIdentifier as It does not fit environment with 2 threads, it gives different IDs in different threads.

Testing

  • All kind of message types
  • See that all updates come and see in time (need to check because of usage of debounce)
  • Long history with a lot of messages
  • Live updates on hight load

Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

UI accessibility checklist

If your PR includes UI changes, please utilize this checklist:

  • Make sure you use the API for UI elements that support large fonts.
  • All colors are taken from WireDesign.ColorTheme or constructed using WireDesign.BaseColorPalette.
  • New UI elements have Accessibility strings for VoiceOver.

Comment thread wire-ios-data-model/Source/Model/Message/ConversationMessage.swift
Comment thread wire-ios/Wire-iOS/Sources/AppDelegate.swift Outdated
@dmitrysimkin dmitrysimkin changed the title Chore/offload conversation calculation chore: offload conversation calculation - WPB-17293 Apr 22, 2025
@dmitrysimkin dmitrysimkin requested review from a team, KaterinaWire, caldrian, johnxnguyen, jullianm and netbe and removed request for a team April 22, 2025 07:11
@samwyndham samwyndham self-requested a review April 28, 2025 12:00
Comment thread wire-ios-utilities/Source/Public/SafeSubscript.swift
Comment thread wire-ios-utilities/Source/Public/SafeSubscript.swift
Comment thread wire-ios/Wire-iOS/Sources/AppDelegate.swift Outdated
Comment thread wire-ios/Wire-iOS/Sources/Helpers/UITraitEnvironment+LayoutMargins.swift Outdated
Comment thread wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift Outdated
Copy link
Copy Markdown
Contributor

@samwyndham samwyndham left a comment

Choose a reason for hiding this comment

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

Apologies @dmitrysimkin for the slow review of this. Well done for fighting with this screen. To be honest this screen deserves a complete rewrite as I believe the current way it is implemented is fundamentally flawed.

Comment thread wire-ios-data-model/Source/Model/User/UserType.swift
Comment thread wire-ios-data-model/Source/ManagedObjectContext/CoreDataStack.swift
@dmitrysimkin dmitrysimkin enabled auto-merge May 6, 2025 12:20
@dmitrysimkin dmitrysimkin added this pull request to the merge queue May 6, 2025
auto-merge was automatically disabled May 6, 2025 13:08

Pull Request is not mergeable

Merged via the queue into develop with commit 629b55f May 6, 2025
14 checks passed
@dmitrysimkin dmitrysimkin deleted the chore/offload-conversation-calculation branch May 6, 2025 13:49
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.

4 participants