overtake / TelegramSwift

Source code of Telegram for macos on Swift 5.0
https://macos.telegram.org
GNU General Public License v2.0
4.94k stars 827 forks source link

UI Freeze/Unresponsive when switching conversation if Time Machine is backing up #484

Open gaplo917 opened 4 years ago

gaplo917 commented 4 years ago

Telegram MacOS

I think it is an performance regression issues.

Video demo

Telegram Desktop

Comparatively, telegram desktop is very smooth.

Video demo


Updates: The Mac's Time machine is performing "Preparing Data" to cause this issue. That mean if a Mac is under heavy I/O, the telegram UI become unresponsive.

P.S. My iMac is 1TB NVMe SSD and backing up to Thunderbolt 3 HDD storage

zweeltow commented 4 years ago

Can you explain your macOS and Telegram version?

gaplo917 commented 4 years ago

@zweeltow macOS: 10.15.5 Telegram macOS: 6.2.3 (202354) Stable

overtake commented 4 years ago

probably your hard-drive/ssd is lagging

gaplo917 commented 4 years ago

@overtake You can check the recording time and my machine specification(Top spec MacbookPro 16”) in the videos. Also, two videos were recorded nearly the same time to prove that it is a frontend implementation issue but not telegram backend issue.

The laggy is not related to system loading because telegram desktop has no issues at nearly the same moment.

Before I decide to report this issues, I encounter this for a long period(about 2 days) and can 100% reproduce even Cmd + Q to restart the Telegram macOS.

If you think it is an I/O issue, is that a user action that triggering a blocking I/O read implementation before performing the action can be improved by non-blocking implementation?

Or the I/O reading can be performed in background thread instead of main thread?

Or use more system memory(fixed size of LRU cache) to store the serialized chat history?

As I use telegram nearly for everything, just want to improve the speed of native macOS client that support secret chat.

gaplo917 commented 4 years ago

@overtake I can reproduce the laggy when the Time Machine is under "Preparing data" stage (iMac 1TB SSD). It is a I/O issues. That's why I keep encounter this issue at some moments that has no CPU & GPU loading.

As I mentioned, I would suggest to hold recent chats in memory rather than read it from disk each time when switching the chats.