GetStream / stream-chat-swift

๐Ÿ’ฌ iOS Chat SDK in Swift - Build your own app chat experience for iOS using the official Stream Chat API
https://getstream.io/chat/sdk/ios/
Other
861 stars 211 forks source link

Replace shared current user observer used for reading privacy settings #3502

Closed laevandus closed 1 day ago

laevandus commented 2 days ago

๐Ÿ”— Issue Links

Part of IOS-558

๐ŸŽฏ Goal

Remove current user controller since it takes unnecessary CPU time when reacting to DB changes

๐Ÿ“ Summary

๐Ÿ›  Implementation

We had a perf issue some time ago where we used to create the ChatCurrentUserController every single time when checking for typing state (on each key press). Then we started to use a shared instance for that. Solved the issue, but there is one downside, reacting to current user changes can get expensive (e.g. current user has many muted channels which triggers recreating channel objects when updating the immutable CurrentChatUser type). Instead all of this, we should just read the data we need and skip controllers.

๐Ÿงช Manual Testing Notes

Try typing events, if disabled, should not appear, otherwise appear.

โ˜‘๏ธ Contributor Checklist

Stream-SDK-Bot commented 2 days ago

SDK Size

title develop branch diff status
StreamChat 7.02 MB 7.02 MB 0 KB ๐ŸŸข
StreamChatUI 4.96 MB 4.96 MB 0 KB ๐ŸŸข
Stream-SDK-Bot commented 2 days ago

SDK Performance

target metric benchmark branch performance status
MessageList Hitches total duration 10 ms 3.34 ms 66.6% ๐Ÿ”ผ ๐ŸŸข
Duration 2.6 s 2.55 s 1.92% ๐Ÿ”ผ ๐ŸŸข
Hitch time ratio 4 ms per s 1.31 ms per s 67.25% ๐Ÿ”ผ ๐ŸŸข
Frame rate 75 fps 78.22 fps 4.29% ๐Ÿ”ผ ๐ŸŸข
Number of hitches 1 0.4 60.0% ๐Ÿ”ผ ๐ŸŸข
Stream-SDK-Bot commented 2 days ago

SDK Size

title develop branch diff status
StreamChat 7.06 MB 7.06 MB +1 KB ๐ŸŸข
StreamChatUI 4.96 MB 4.96 MB 0 KB ๐ŸŸข
sonarcloud[bot] commented 1 day ago

Quality Gate Passed Quality Gate passed

Issues
167 New issues
0 Accepted issues

Measures
0 Security Hotspots
83.7% Coverage on New Code
0.1% Duplication on New Code

See analysis details on SonarQube Cloud

laevandus commented 1 day ago

QAed with @testableapple