-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TDLib 1.7: Performance degradation with message database? #1322
Comments
There was a request to SQLite database at that time. 5 seconds is the value of Line 43 in eb80924
Are you using our CMake scripts to build TDLib with that define set? |
Yes, I do. I was following the build instructions which were made up by the generator:
But is it really important if |
There are should be no problems in accessing simultaneously different databases. Could you enable logging of all SQLite requests using Between, it is not possible to link the same app against two different SQLite versions on Linux, because there will be conflincting function definitions. How did you solve this? |
Also |
Nothing to see in addition - with level 3. I used level 5, but there is also hardly any additional information:
The respective strace log looks a little bit more interesting (though I'm an absolut noob in that area). Out of memory errors are quite frequent - however, no idea if they are relevant in that context. Though, there were still >2GB out of 4GB memory free - continuously during startup. I attached an excerpt of the fernschreiber-strace-sqlite.txt Moreover, I personally didn't need to solve anything with respect to sqlite. I simply used the normal Qt SQL functions - worked flawlessly so far. |
This means that you set "sqlite" tag verbosity level to 5 and not 3. I see no evident problems in the strace output. ENOMEM errors aren't an issue. Just everything is very slow and database opening takes almost 3 seconds. Between, provided strace output corresponds to application launch and not the time 1607539280 - 1607539286. Could you provide How much processor cores are available to the app? |
Yes, I increased it to 5... Please find the new strace log attached. I used the options that you provided plus fernschreiber-strace-sqlite-2.txt The device is a Sony Xperia X (Snapdragon 650, 6 cores, 2 faster ones, 4 slower ones). |
@Wunderfitz I see nothing suspicious, except system calls are very slow. In my tests calls to mlock last at most 10-15 microseconds instead of 1000-2000 microseconds in your log. Also, there are a lot of "unfinished" system calls in the log, i.e. there was a context switch during them. Context switches shouldn't be so common, unless there are not enough processor cores. From the other side calls to Line 40 in eb80924
|
Thank you very much for the analysis and for the hint, will try tomorrow as builds take a while and it's already pretty late here... |
@levlam OK, I tried, but obviously I failed. With this option, the build of the sqlite part fails:
Removing it again makes the build to pass. Any additional ideas? Again thanks for taking care! |
Then this is another time SQLCipher broke amalgamation build. Comment lines 22558 ( |
OK, sorry for the late answer, I had a lot to do over the weekend. With this change the build was successful and I just tested it the first time. What shall I say: Incredible, the 5s delay is completely gone! It's actually not just that, the startup now feels even faster than with v1.6! (Need to measure that in detail however to be sure, but I'd say it doesn't matter - at least on ARM I don't see blockers anymore). I'll do the i486 build as well and if it looks the same there and I don't encounter any other issues on other devices, I'll close this ticket. I'll keep you posted! |
OK, seems to work properly, no performance issues anymore, impressive! Thanks again for the help and for your work on TDLib. I'll close this issue now. 👍 |
After the release of TDLib 1.7 I did the necessary adjustments to my project so that the new library version can be used soon. However, it seems that my application now suffers from a massive performance degradation during startup if the message database is used. On the same device with the same Telegram account and the same codebase of my app (OK, with small adjustments due to changes how senders or thumbnails are handled), the app now takes about 5 seconds longer to load. During use, performance seems to be more or less the same as with TDLib 1.6.
After having verbose debug logging switched on (level 5), the log revealed that TDLib seems to do nothing for about 5 seconds:
Just to be sure, I removed and re-initialized the database three times - no change. Without the message database, there are no delays, but I'd like to keep it as some nice features are only available with the message database. As said, a fresh install of the app with TDLib 1.6 directly afterwards resulted in an app without any startup delays.
Any ideas, anything I can do?
The text was updated successfully, but these errors were encountered: