Skip to content
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

Closed
Wunderfitz opened this issue Dec 8, 2020 · 13 comments
Closed

TDLib 1.7: Performance degradation with message database? #1322

Wunderfitz opened this issue Dec 8, 2020 · 13 comments

Comments

@Wunderfitz
Copy link

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:

[ 3][t 4][1607455342.965187788][MessagesManager.cpp:12901][#1][!Td]	Receive server message 207388 in chat -1001094603738 from user 71131235/chat 0
[ 3][t 4][1607455342.965258359][MessagesManager.cpp:13017][#1][!Td]	Found temporarily invalid message 0 for server message 207388 in chat -1001094603738
[ 3][t 4][1607455342.965288400][MessagesManager.cpp:31080][#1][!Td]	Adding server message 207388 of type Text to chat -1001094603738 from updateNewChannelMessage. Last new is server message 207387, last is server message 207387, from_update = true, have_previous = true, have_next = true
[ 3][t 4][1607455342.965328216][MessagesManager.cpp:30895][#1][!Td]	Search for server message 207388 in chat -1001094603738 found (nil)
[ 3][t 4][1607455342.965358972][MessagesManager.cpp:30927][#1][!Td]	Trying to load server message 207388 in chat -1001094603738 from database from add_message_to_dialog 2
[ 3][t 0][1607455343.795862436][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607455343.795984506][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1607455344.797270059][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607455344.797348260][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1607455345.799003124][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607455345.799047231][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1607455346.800163269][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607455346.800257444][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1607455347.802096128][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607455347.802183866][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 4][1607455347.970407724][MessagesManager.cpp:30895][#1][!Td]	Search for server message 207378 in chat -1001094603738 found (nil)
[ 3][t 4][1607455347.970505475][MessagesManager.cpp:30927][#1][!Td]	Trying to load server message 207378 in chat -1001094603738 from database from preload top reply message
[ 3][t 4][1607455347.974346637][MessagesManager.cpp:21465][#1][!Td]	Loaded message of size 140 from database[ 3][t 4][1607455347.976071357][MessagesManager.cpp:30895][#1][!Td]	Search for server message 207378 in chat -1001094603738 found (nil)

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?

@levlam
Copy link
Contributor

levlam commented Dec 9, 2020

There was a request to SQLite database at that time. 5 seconds is the value of sqlite3_busy_timeout used by TDLib, which is a maximum time the SQLite tries to lock the database before returning an error for the request. Whenever SQLite encounters a locked database, it calls usleep/sleep multiple times. It expects another thread/process to unlock the database after some short time and to be able to lock it after that. SQLite uses usleep instead of sleep if it is built with HAVE_USLEEP define. usleep usage is preferred for better performance, so we always build SQLite with this define set:

target_compile_definitions(tdsqlite PRIVATE -DHAVE_USLEEP -DNDEBUG=1)
.

Are you using our CMake scripts to build TDLib with that define set?

@Wunderfitz
Copy link
Author

Yes, I do. I was following the build instructions which were made up by the generator:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DTD_ENABLE_LTO=ON ..
cmake --build . --target install

But is it really important if usleep or sleep is used? A lock on the database every time on startup sounds like a general issue. Is there any chance to trace accesses to the SQLite database and could it be relevant if other SQLite databases are accessed during startup (I have another SQLite DB which is only used by the app itself)?

@levlam
Copy link
Contributor

levlam commented Dec 9, 2020

There are should be no problems in accessing simultaneously different databases. Could you enable logging of all SQLite requests using setLogTagVerbosityLevel("sqlite", 3)?

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?

@levlam
Copy link
Contributor

levlam commented Dec 9, 2020

Also strace outout can help to find, when the database is locked and unlocked.

@Wunderfitz
Copy link
Author

Nothing to see in addition - with level 3. I used level 5, but there is also hardly any additional information:

[ 3][t 4][1607539280.721049547][MessagesManager.cpp:30927][#1][!Td]	Trying to load server message 242971 in chat 65609948 from database from add_message_to_dialog 2
[ 5][t 1][1607539280.787066698][SqliteDb.cpp:119][#1][!KV][&sqlite]	Start exec [query:PRAGMA synchronous=NORMAL][database:0xf032b990][ 5][t 1][1607539280.787562847][SqliteDb.cpp:123][#1][!KV][&sqlite]	Finish exec [query:PRAGMA synchronous=NORMAL][database:0xf032b990]
[ 5][t 1][1607539280.787730932][SqliteDb.cpp:119][#1][!KV][&sqlite]	Start exec [query:PRAGMA temp_store=MEMORY][database:0xf032b990]
[ 5][t 1][1607539280.787899494][SqliteDb.cpp:123][#1][!KV][&sqlite]	Finish exec [query:PRAGMA temp_store=MEMORY][database:0xf032b990]
[ 5][t 1][1607539280.788056612][SqliteDb.cpp:119][#1][!KV][&sqlite]	Start exec [query:PRAGMA secure_delete=1][database:0xf032b990]
[ 5][t 1][1607539280.788225173][SqliteDb.cpp:123][#1][!KV][&sqlite]	Finish exec [query:PRAGMA secure_delete=1][database:0xf032b990]
[ 5][t 1][1607539280.788380861][SqliteDb.cpp:119][#1][!KV][&sqlite]	Start exec [query:PRAGMA recursive_triggers=1][database:0xf032b990]
[ 5][t 1][1607539280.788548707][SqliteDb.cpp:123][#1][!KV][&sqlite]	Finish exec [query:PRAGMA recursive_triggers=1][database:0xf032b990]
[ 3][t 0][1607539281.600804090][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607539281.600876092][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1607539282.602328062][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607539282.602445363][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1607539283.604043245][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607539283.604109764][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1607539284.611289501][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607539284.611397266][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 3][t 0][1607539285.612565755][Client.cpp:282][&td_requests]	End to wait for updates, returning object 0 (nil)
[ 3][t 0][1607539285.612640619][Client.cpp:274][&td_requests]	Begin to wait for updates with timeout 1.000000
[ 5][t 4][1607539285.916070938][SqliteStatement.cpp:181][#1][!Td][&sqlite]	Start step [query:SELECT data FROM messages WHERE dialog_id = ?1 AND message_id = ?2][statement:0xf0082410][database:0xf0009dc4]
[ 5][t 4][1607539285.919831514][SqliteStatement.cpp:184][#1][!Td][&sqlite]	Finish step [query:SELECT data FROM messages WHERE dialog_id = ?1 AND message_id = [?2][statement:0xf0082410][database:0xf0009dc4]]

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 db.sqlite-related logs as a file here.

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.

@levlam
Copy link
Contributor

levlam commented Dec 10, 2020

Nothing to see in addition - with level 3. I used level 5,

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 strace -v -T -r output, so it can be seen, whether the system calls are slow, or everything is slow in between?

How much processor cores are available to the app?

@Wunderfitz
Copy link
Author

Yes, I increased it to 5...

Please find the new strace log attached. I used the options that you provided plus -f - otherwise nothing would be there from TDLib...

fernschreiber-strace-sqlite-2.txt

The device is a Sony Xperia X (Snapdragon 650, 6 cores, 2 faster ones, 4 slower ones).

@levlam
Copy link
Contributor

levlam commented Dec 10, 2020

@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 clock_gettime have expected performance, so there can be a problem specific to mlock/munlock system calls and Sailfish OS. You can try to build SQLite with define "OMIT_MEMLOCK" to completely remove these calls, Just add "-DOMIT_MEMLOCK" to

target_compile_definitions(tdsqlite PRIVATE -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -DSQLITE_ENABLE_FTS5 -DSQLITE_DISABLE_LFS)
.

@Wunderfitz
Copy link
Author

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...

@Wunderfitz
Copy link
Author

@levlam OK, I tried, but obviously I failed. With this option, the build of the sqlite part fails:

Scanning dependencies of target tdsqlite
[ 20%] Building C object sqlite/CMakeFiles/tdsqlite.dir/sqlite/sqlite3.c.o
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38802:42: error: ‘close’ undeclared here (not in a function); did you mean ‘clone’?
   { "close",        (sqlite3_syscall_ptr)close,      0  },
                                          ^~~~~
                                          clone
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38805:42: error: ‘access’ undeclared here (not in a function); did you mean ‘acosl’?
   { "access",       (sqlite3_syscall_ptr)access,     0  },
                                          ^~~~~~
                                          acosl
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38808:42: error: ‘getcwd’ undeclared here (not in a function); did you mean ‘getcpu’?
   { "getcwd",       (sqlite3_syscall_ptr)getcwd,     0  },
                                          ^~~~~~
                                          getcpu
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38828:42: error: ‘ftruncate’ undeclared here (not in a function); did you mean ‘strncat’?
   { "ftruncate",    (sqlite3_syscall_ptr)ftruncate,  0  },
                                          ^~~~~~~~~
                                          strncat
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38834:42: error: ‘read’ undeclared here (not in a function); did you mean ‘fread’?
   { "read",         (sqlite3_syscall_ptr)read,       0  },
                                          ^~~~
                                          fread
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38851:42: error: ‘write’ undeclared here (not in a function); did you mean ‘fwrite’?
   { "write",        (sqlite3_syscall_ptr)write,      0  },
                                          ^~~~~
                                          fwrite
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38880:42: error: ‘unlink’ undeclared here (not in a function); did you mean ‘uint’?
   { "unlink",       (sqlite3_syscall_ptr)unlink,           0 },
                                          ^~~~~~
                                          uint
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38889:42: error: ‘rmdir’ undeclared here (not in a function); did you mean ‘mkdir’?
   { "rmdir",        (sqlite3_syscall_ptr)rmdir,           0 },
                                          ^~~~~
                                          mkdir
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38893:42: error: ‘fchown’ undeclared here (not in a function); did you mean ‘fchmod’?
   { "fchown",       (sqlite3_syscall_ptr)fchown,          0 },
                                          ^~~~~~
                                          fchmod
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38900:42: error: ‘geteuid’ undeclared here (not in a function); did you mean ‘getenv’?
   { "geteuid",      (sqlite3_syscall_ptr)geteuid,         0 },
                                          ^~~~~~~
                                          getenv
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38907:42: error: ‘mmap’ undeclared here (not in a function); did you mean ‘fmal’?
   { "mmap",         (sqlite3_syscall_ptr)mmap,            0 },
                                          ^~~~
                                          fmal
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38914:42: error: ‘munmap’ undeclared here (not in a function); did you mean ‘fminmag’?
   { "munmap",       (sqlite3_syscall_ptr)munmap,          0 },
                                          ^~~~~~
                                          fminmag
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38921:42: error: ‘mremap’ undeclared here (not in a function); did you mean ‘creat’?
   { "mremap",       (sqlite3_syscall_ptr)mremap,          0 },
                                          ^~~~~~
                                          creat
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38935:42: error: ‘readlink’ undeclared here (not in a function); did you mean ‘realloc’?
   { "readlink",     (sqlite3_syscall_ptr)readlink,        0 },
                                          ^~~~~~~~
                                          realloc
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c: In function ‘seekAndRead’:
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:41709:17: warning: implicit declaration of function ‘lseek’; did you mean ‘fseek’? [-Wimplicit-function-declaration]
     newOffset = lseek(id->h, offset, SEEK_SET);
                 ^~~~~
                 fseek
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c: In function ‘full_fsync’:
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:41951:20: warning: implicit declaration of function ‘fsync’ [-Wimplicit-function-declaration]
 # define fdatasync fsync
                    ^~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:42049:8: note: in expansion of macro ‘fdatasync’
   rc = fdatasync(fd);
        ^~~~~~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c: In function ‘unixGetpagesize’:
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:42616:15: warning: implicit declaration of function ‘sysconf’; did you mean ‘sscanf’? [-Wimplicit-function-declaration]
   return (int)sysconf(_SC_PAGESIZE);
               ^~~~~~~
               sscanf
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:42616:23: error: ‘_SC_PAGESIZE’ undeclared (first use in this function); did you mean ‘S_BLKSIZE’?
   return (int)sysconf(_SC_PAGESIZE);
                       ^~~~~~~~~~~~
                       S_BLKSIZE
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:42616:23: note: each undeclared identifier is reported only once for each function it appears in
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c: In function ‘unixShmMap’:
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43169:36: error: ‘PROT_READ’ undeclared (first use in this function); did you mean ‘TRANS_READ’?
             pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE,
                                    ^~~~~~~~~
                                    TRANS_READ
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43169:58: error: ‘PROT_WRITE’ undeclared (first use in this function); did you mean ‘CRYPTO_WRITE’?
             pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE,
                                                          ^~~~~~~~~~
                                                          CRYPTO_WRITE
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43169:57: error: invalid operands to binary | (have ‘struct unix_syscall *’ and ‘struct unix_syscall *’)
             pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE,
                                                ~~~~~~~~~^
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43170:13: error: ‘MAP_SHARED’ undeclared (first use in this function)
             MAP_SHARED, pShmNode->hShm, szRegion*(i64)pShmNode->nRegion
             ^~~~~~~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43169:46: warning: passing argument 3 of ‘(void * (*)(void *, size_t,  int,  int,  int,  off_t))aSyscall[22].pCurrent’ makes integer from pointer without a cast [-Wint-conversion]
             pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE,
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43169:46: note: expected ‘int’ but argument is of type ‘struct unix_syscall *’
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43170:13: warning: passing argument 4 of ‘(void * (*)(void *, size_t,  int,  int,  int,  off_t))aSyscall[22].pCurrent’ makes integer from pointer without a cast [-Wint-conversion]
             MAP_SHARED, pShmNode->hShm, szRegion*(i64)pShmNode->nRegion
             ^~~~~~~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43170:13: note: expected ‘int’ but argument is of type ‘struct unix_syscall *’
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43172:19: error: ‘MAP_FAILED’ undeclared (first use in this function); did you mean ‘TK_FAIL’?
         if( pMem==MAP_FAILED ){
                   ^~~~~~~~~~
                   TK_FAIL
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c: In function ‘unixRemapfile’:
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43433:15: error: ‘PROT_READ’ undeclared (first use in this function); did you mean ‘TRANS_READ’?
   int flags = PROT_READ;               /* Flags to pass to mmap() */
               ^~~~~~~~~
               TRANS_READ
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43433:15: warning: initialization of ‘int’ from ‘struct unix_syscall *’ makes integer from pointer without a cast [-Wint-conversion]
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43461:42: error: ‘MREMAP_MAYMOVE’ undeclared (first use in this function)
     pNew = osMremap(pOrig, nReuse, nNew, MREMAP_MAYMOVE);
                                          ^~~~~~~~~~~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43461:42: warning: passing argument 4 of ‘(void * (*)(void *, size_t,  size_t,  int,  ...))aSyscall[24].pCurrent’ makes integer from pointer without a cast [-Wint-conversion]
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43461:42: note: expected ‘int’ but argument is of type ‘struct unix_syscall *’
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43476:15: error: ‘MAP_FAILED’ undeclared (first use in this function); did you mean ‘TK_FAIL’?
     if( pNew==MAP_FAILED || pNew==0 ){
               ^~~~~~~~~~
               TK_FAIL
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43476:13: warning: comparison of distinct pointer types lacks a cast
     if( pNew==MAP_FAILED || pNew==0 ){
             ^~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43483:35: error: ‘MAP_SHARED’ undeclared (first use in this function)
     pNew = osMmap(0, nNew, flags, MAP_SHARED, h, 0);
                                   ^~~~~~~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43483:35: warning: passing argument 4 of ‘(void * (*)(void *, size_t,  int,  int,  int,  off_t))aSyscall[22].pCurrent’ makes integer from pointer without a cast [-Wint-conversion]
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43483:35: note: expected ‘int’ but argument is of type ‘struct unix_syscall *’
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:43486:11: warning: comparison of distinct pointer types lacks a cast
   if( pNew==MAP_FAILED ){
           ^~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c: In function ‘unixOpen’:
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:38400:28: warning: implicit declaration of function ‘getpid’; did you mean ‘getpt’? [-Wimplicit-function-declaration]
 #define osGetpid(X) (pid_t)getpid()
                            ^~~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:44414:22: note: in expansion of macro ‘osGetpid’
   if( randomnessPid!=osGetpid(0) ){
                      ^~~~~~~~
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c: In function ‘unixSleep’:
/home/ygriega/git/td/sqlite/sqlite/sqlite3.c:44930:3: warning: implicit declaration of function ‘usleep’; did you mean ‘fseek’? [-Wimplicit-function-declaration]
   usleep(microseconds);
   ^~~~~~
   fseek
gmake[2]: *** [sqlite/CMakeFiles/tdsqlite.dir/build.make:63: sqlite/CMakeFiles/tdsqlite.dir/sqlite/sqlite3.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1202: sqlite/CMakeFiles/tdsqlite.dir/all] Error 2
gmake: *** [Makefile:141: all] Error 2

Removing it again makes the build to pass. Any additional ideas? Again thanks for taking care!

@levlam
Copy link
Contributor

levlam commented Dec 11, 2020

Then this is another time SQLCipher broke amalgamation build. Comment lines 22558 (#ifndef OMIT_MEMLOCK) and 22567 (#endif) in the file sqlite/sqlite/sqlite3.c to fix this and continue building with the OMIT_MEMLOCK define.

@Wunderfitz
Copy link
Author

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!

@Wunderfitz
Copy link
Author

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. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants