/soc/2015/igor.gajowiak/chatlog: 32332ec9ecf0: SQLite optimizati...
Igor Gajowiak
igor.gajowiak at gmail.com
Sun Jul 19 11:14:41 EDT 2015
Changeset: 32332ec9ecf0a12661d5f8b6a4fc1decae1afe20
Author: Igor Gajowiak <igor.gajowiak at gmail.com>
Date: 2015-07-19 17:14 +0200
Branch: default
URL: https://hg.pidgin.im/soc/2015/igor.gajowiak/chatlog/rev/32332ec9ecf0
Description:
SQLite optimization: add sqlite pragmas.
diffstat:
libpurple/plugins/log/logsqlite.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diffs (25 lines):
diff --git a/libpurple/plugins/log/logsqlite.c b/libpurple/plugins/log/logsqlite.c
--- a/libpurple/plugins/log/logsqlite.c
+++ b/libpurple/plugins/log/logsqlite.c
@@ -203,6 +203,11 @@ static int
sqlitelog_create_tables(sqlite3 *db_handle)
{
const char *query =
+ // These pragmas are needed to achieve a reasonable performance,
+ // without them updates are ~3k times slower
+ "PRAGMA synchronous=OFF; "
+ "PRAGMA journal_mode=MEMORY; "
+
"CREATE TABLE Accounts("
"Id INTEGER PRIMARY KEY AUTOINCREMENT,"
"Username TEXT NOT NULL,"
@@ -423,6 +428,9 @@ sqlitelog_get_unseen_msgs_impl(PurpleAcc
PurpleMessage *msg = purple_message_new(author, author_alias,
recipient, contents, msg_time, msg_flags);
+ g_object_set_data(G_OBJECT(msg), SQLITELOG_MESSAGE_ID_ATTR,
+ GUINT_TO_POINTER(id));
+
messages = g_list_prepend(messages, msg);
}
More information about the Commits
mailing list