/soc/2015/igor.gajowiak/chatlog: 32332ec9ecf0: SQLite optimizati...

Igor Gajowiak <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: 32332ec9ecf0a12661d5f8b6a4fc1decae1afe20
Author:	 Igor Gajowiak <[email protected]>
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);
 	}
 

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.