tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
6.99k stars 1.43k forks source link

WASM: long updates after initialization #647

Closed MattNguyen closed 5 years ago

MattNguyen commented 5 years ago

We're currently shipping the wasm build to the browser similarly to telegram-react. The biggest difference is that telegram-react's initial load and update time appears much faster. It seems like we're waiting for tdlib to finish updating, which can take a long time.

Do you have any suggestions to improve initial load performance? Would use_database be helpful here or patches to build tdlib more performant? I don't think telegram-react turns that flag on.

Any guidance would be greatly appreciated. Thanks!

arseny30 commented 5 years ago

Are you using tdweb wrapper for tdlib?

MattNguyen commented 5 years ago

@arseny30 yes we're using the wrapper, which is packaged from the examples/web directory I believe.

arseny30 commented 5 years ago

Maybe .wasm is downloaded every time in your case? In telegram-react it is cached with service-worker.

Also there is a hack for the very first start in telegram-react. It doesn't wait for tdweb to start and just shows login window immediately.

levlam commented 5 years ago

@MattNguyen Telegram-react also uses useDatabase == false to launch immediately from a clear state without getting all missed updates.

MattNguyen commented 5 years ago

Thanks guys.

We ended up implementing a ReactDOM.unstable_batchedUpdates which made the app more responsive.

Closing for now.