Slow type-checking in ChatMessageImageAttachment.swift #3428
Labels
⚡ Performance
An Issue or PR related to performance improvements
🌐 SDK: StreamChat (LLC)
Tasks related to the StreamChat LLC SDK
🔜 Upcoming
This issue is fixed in “develop” and will be available in the next release
What did you do?
Checked type-checking in our project and found a couple lines that took a while to type-check
What did you expect to happen?
I found that many of the most expensive expressions to typecheck were from this repo:
https://github.com/GetStream/stream-chat-swift/blob/develop/Sources/StreamChat/Models/Attachments/ChatMessageImageAttachment.swift#L128
and
https://github.com/GetStream/stream-chat-swift/blob/develop/Sources/StreamChat/Models/Attachments/ChatMessageImageAttachment.swift#L131
took 80ms and 60ms respectively on my laptop (2021 M1). If this was written without the
??
it would likely take 1-2ms.https://github.com/GetStream/stream-chat-swift/blob/develop/Sources/StreamChatUI/StreamNuke/Internal/ImageRequestKeys.swift#L50
took 32ms
These were the most expensive expressions, but I encourage you to run with the
-debug-time-expression-type-checking
on the framework to see other locations that are taking a whileGetStream Environment
**GetStream Chat version: 4.63.0
**GetStream Chat frameworks: StreamChat
**iOS version: 18
**Swift version: 6
**Xcode version: 16
**Device: iOS Sim
Additional context
https://danielchasehooper.com/posts/why-swift-is-slow/
The text was updated successfully, but these errors were encountered: