From 3e394f14e84a2d8d34e9ff89ab714792b663d352 Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 3 Jan 2022 23:03:54 +0000 Subject: [PATCH] sql: disable `cipher_memory_security` SQLCipher PRAGMA It slows down dc_get_chat_msgs() from ~50ms to seconds on Android. It is disabled by default in SQLCipher 4.5.0, but currently SQLCipher 4.4.3 is bundled so this PRAGMA has to be disabled manually. --- src/sql.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sql.rs b/src/sql.rs index 15f72cf28..a83945cac 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -84,7 +84,8 @@ impl Sql { .with_flags(open_flags) .with_init(|c| { c.execute_batch(&format!( - "PRAGMA secure_delete=on; + "PRAGMA cipher_memory_security = OFF; -- Too slow on Android + PRAGMA secure_delete=on; PRAGMA busy_timeout = {}; PRAGMA temp_store=memory; -- Avoid SQLITE_IOERR_GETTEMPPATH errors on Android ",