Wunderfitz / harbour-fernschreiber

Fernschreiber is a Telegram client for Sailfish OS
GNU General Public License v3.0
43 stars 34 forks source link

tdlibwrapper refactoring and optimization #571

Closed mbarashkov closed 5 months ago

mbarashkov commented 5 months ago

A few small changes to tdlibwrapper:

  1. Refactored misleadingly names variables allUsers and to more proper names usersById and usersByName.
  2. Fixed handleUserUpdated function as it mixed up userInformation parameter with userInformation member variable.
  3. Made a dedicated method updateUserInformation to update both usersById and usersByName
  4. Eliminated unneeded status updates when user status didn't really change (those tend to happen a lot).
monich commented 5 months ago

As a side note, I find it weird that QString's and QVariant's are being used to store the user id (which is int53 according to td_api.tl), qlonglong would be far more efficient both in terms of memory usage and overall efficiency (e.g. hashing and comparison). The change itself looks ok to me.

mbarashkov commented 5 months ago

@monich it doesn't make much sense, however, those go quite deep in the code, so I don't want to fix it right now, there are more obvious areas to improve.

monich commented 5 months ago

yes, I agree

monich commented 5 months ago

Egh, the commit message wasn't formatted in a sane way... Too late to fix this one but let's pay more attention to that in the future