[tracker] libtracker-data, libtracker-db: Various performance improvements, and a compilation fix
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data, libtracker-db: Various performance improvements, and a compilation fix
- Date: Wed, 14 Apr 2010 14:25:28 +0000 (UTC)
commit 3ea56dc32505298adf93ff380b2e0d0b68190fa4
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Apr 14 16:24:19 2010 +0200
libtracker-data, libtracker-db: Various performance improvements, and a compilation fix
src/libtracker-data/tracker-namespace.c | 24 ++++----
src/libtracker-data/tracker-namespace.h | 3 +
src/libtracker-data/tracker-property.c | 10 +++-
src/libtracker-db/tracker-db-interface-sqlite.c | 8 ++--
src/libtracker-db/tracker-db-interface.c | 65 ++++++++++++++++++-----
5 files changed, 79 insertions(+), 31 deletions(-)
---
diff --git a/src/libtracker-data/tracker-namespace.c b/src/libtracker-data/tracker-namespace.c
index d2fdb94..f296c48 100644
--- a/src/libtracker-data/tracker-namespace.c
+++ b/src/libtracker-data/tracker-namespace.c
@@ -26,11 +26,10 @@
#include "tracker-namespace.h"
-#define GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_NAMESPACE, TrackerNamespacePriv))
+#define GET_PRIV(obj) (((TrackerNamespace*)obj)->priv)
+#define TRACKER_NAMESPACE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TRACKER_TYPE_NAMESPACE, TrackerNamespacePrivate))
-typedef struct _TrackerNamespacePriv TrackerNamespacePriv;
-
-struct _TrackerNamespacePriv {
+struct _TrackerNamespacePrivate {
gchar *uri;
gchar *prefix;
gboolean is_new;
@@ -47,18 +46,19 @@ tracker_namespace_class_init (TrackerNamespaceClass *klass)
object_class->finalize = namespace_finalize;
- g_type_class_add_private (object_class, sizeof (TrackerNamespacePriv));
+ g_type_class_add_private (object_class, sizeof (TrackerNamespacePrivate));
}
static void
tracker_namespace_init (TrackerNamespace *service)
{
+ service->priv = TRACKER_NAMESPACE_GET_PRIVATE (service);
}
static void
namespace_finalize (GObject *object)
{
- TrackerNamespacePriv *priv;
+ TrackerNamespacePrivate *priv;
priv = GET_PRIV (object);
@@ -81,7 +81,7 @@ tracker_namespace_new (void)
const gchar *
tracker_namespace_get_uri (TrackerNamespace *namespace)
{
- TrackerNamespacePriv *priv;
+ TrackerNamespacePrivate *priv;
g_return_val_if_fail (TRACKER_IS_NAMESPACE (namespace), NULL);
@@ -93,7 +93,7 @@ tracker_namespace_get_uri (TrackerNamespace *namespace)
const gchar *
tracker_namespace_get_prefix (TrackerNamespace *namespace)
{
- TrackerNamespacePriv *priv;
+ TrackerNamespacePrivate *priv;
g_return_val_if_fail (TRACKER_IS_NAMESPACE (namespace), NULL);
@@ -105,7 +105,7 @@ tracker_namespace_get_prefix (TrackerNamespace *namespace)
gboolean
tracker_namespace_get_is_new (TrackerNamespace *namespace)
{
- TrackerNamespacePriv *priv;
+ TrackerNamespacePrivate *priv;
g_return_val_if_fail (TRACKER_IS_NAMESPACE (namespace), FALSE);
@@ -118,7 +118,7 @@ void
tracker_namespace_set_uri (TrackerNamespace *namespace,
const gchar *value)
{
- TrackerNamespacePriv *priv;
+ TrackerNamespacePrivate *priv;
g_return_if_fail (TRACKER_IS_NAMESPACE (namespace));
@@ -137,7 +137,7 @@ void
tracker_namespace_set_prefix (TrackerNamespace *namespace,
const gchar *value)
{
- TrackerNamespacePriv *priv;
+ TrackerNamespacePrivate *priv;
g_return_if_fail (TRACKER_IS_NAMESPACE (namespace));
@@ -156,7 +156,7 @@ void
tracker_namespace_set_is_new (TrackerNamespace *namespace,
gboolean value)
{
- TrackerNamespacePriv *priv;
+ TrackerNamespacePrivate *priv;
g_return_if_fail (TRACKER_IS_NAMESPACE (namespace));
diff --git a/src/libtracker-data/tracker-namespace.h b/src/libtracker-data/tracker-namespace.h
index 9fea3b2..b097e46 100644
--- a/src/libtracker-data/tracker-namespace.h
+++ b/src/libtracker-data/tracker-namespace.h
@@ -37,9 +37,12 @@ G_BEGIN_DECLS
typedef struct _TrackerNamespace TrackerNamespace;
typedef struct _TrackerNamespaceClass TrackerNamespaceClass;
+typedef struct _TrackerNamespacePrivate TrackerNamespacePrivate;
+
struct _TrackerNamespace {
GObject parent;
+ TrackerNamespacePrivate *priv;
};
struct _TrackerNamespaceClass {
diff --git a/src/libtracker-data/tracker-property.c b/src/libtracker-data/tracker-property.c
index 6e97409..8605538 100644
--- a/src/libtracker-data/tracker-property.c
+++ b/src/libtracker-data/tracker-property.c
@@ -253,7 +253,10 @@ tracker_property_get_domain (TrackerProperty *property)
{
TrackerPropertyPrivate *priv;
- g_return_val_if_fail (TRACKER_IS_PROPERTY (property), NULL);
+ /* Removed for performance:
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (property), NULL); */
+
+ g_return_val_if_fail (property != NULL, NULL);
priv = GET_PRIV (property);
@@ -313,7 +316,10 @@ tracker_property_get_fulltext_indexed (TrackerProperty *property)
{
TrackerPropertyPrivate *priv;
- g_return_val_if_fail (TRACKER_IS_PROPERTY (property), FALSE);
+ /* Removed for performance:
+ g_return_val_if_fail (TRACKER_IS_PROPERTY (property), NULL); */
+
+ g_return_val_if_fail (property != NULL, NULL);
priv = GET_PRIV (property);
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index 1337a49..878d1f2 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -40,8 +40,7 @@
#define TRACKER_TYPE_DB_STATEMENT_SQLITE (tracker_db_statement_sqlite_get_type ())
#define TRACKER_DB_STATEMENT_SQLITE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TRACKER_TYPE_DB_STATEMENT_SQLITE, TrackerDBStatementSqlite))
#define TRACKER_DB_STATEMENT_SQLITE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), TRACKER_TYPE_DB_STATEMENT_SQLITE, TrackerDBStatementSqliteClass))
-#define TRACKER_IS_DB_STATEMENT_SQLITE_O(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_DB_STATEMENT_SQLITE))
-#define TRACKER_IS_DB_STATEMENT_SQLITE(o) (((TrackerDBStatementSqlite *)o)->priv)
+#define TRACKER_IS_DB_STATEMENT_SQLITE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_DB_STATEMENT_SQLITE))
#define TRACKER_IS_DB_STATEMENT_SQLITE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((o), TRACKER_TYPE_DB_STATEMENT_SQLITE))
#define TRACKER_DB_STATEMENT_SQLITE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TRACKER_TYPE_DB_STATEMENT_SQLITE, TrackerDBStatementSqliteClass))
@@ -49,7 +48,8 @@
#define TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_DB_INTERFACE_SQLITE, TrackerDBInterfaceSqlitePrivate))
-#define TRACKER_DB_STATEMENT_SQLITE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_DB_STATEMENT_SQLITE, TrackerDBStatementSqlitePrivate))
+#define TRACKER_DB_STATEMENT_SQLITE_GET_PRIVATE(o) (((TrackerDBStatementSqlite *)o)->priv)
+#define TRACKER_DB_STATEMENT_SQLITE_GET_PRIVATE_O(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_DB_STATEMENT_SQLITE, TrackerDBStatementSqlitePrivate))
#define TRACKER_DB_CURSOR_SQLITE_GET_PRIVATE_O(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_DB_CURSOR_SQLITE, TrackerDBCursorSqlitePrivate))
#define TRACKER_DB_CURSOR_SQLITE_GET_PRIVATE(o) (((TrackerDBCursorSqlite *)o)->priv)
@@ -1161,7 +1161,7 @@ tracker_db_cursor_sqlite_iface_init (TrackerDBCursorIface *iface)
static void
tracker_db_statement_sqlite_init (TrackerDBStatementSqlite *stmt)
{
- stmt->priv = TRACKER_IS_DB_STATEMENT_SQLITE_O(stmt);
+ stmt->priv = TRACKER_DB_STATEMENT_SQLITE_GET_PRIVATE_O(stmt);
}
static void
diff --git a/src/libtracker-db/tracker-db-interface.c b/src/libtracker-db/tracker-db-interface.c
index 19810d3..31fe495 100644
--- a/src/libtracker-db/tracker-db-interface.c
+++ b/src/libtracker-db/tracker-db-interface.c
@@ -243,7 +243,10 @@ tracker_db_interface_create_statement (TrackerDBInterface *interface,
va_list args;
gchar *str;
- g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (interface), NULL);
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (interface), NULL); */
+
+ g_return_val_if_fail (interface != NULL, NULL);
g_return_val_if_fail (query != NULL, NULL);
va_start (args, query);
@@ -360,7 +363,10 @@ tracker_db_statement_bind_double (TrackerDBStatement *stmt,
int idx,
double value)
{
- g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL); */
+
+ g_return_if_fail (stmt != NULL);
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_double (stmt, idx, value);
}
@@ -370,7 +376,10 @@ tracker_db_statement_bind_int (TrackerDBStatement *stmt,
int idx,
int value)
{
- g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
+ /* Removed for performance:
+ g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt)); */
+
+ g_return_if_fail (stmt != NULL);
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_int (stmt, idx, value);
}
@@ -380,7 +389,10 @@ tracker_db_statement_bind_int64 (TrackerDBStatement *stmt,
int idx,
gint64 value)
{
- g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL); */
+
+ g_return_if_fail (stmt != NULL);
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_int64 (stmt, idx, value);
}
@@ -389,7 +401,10 @@ void
tracker_db_statement_bind_null (TrackerDBStatement *stmt,
int idx)
{
- g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL); */
+
+ g_return_if_fail (stmt != NULL);
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_null (stmt, idx);
}
@@ -399,7 +414,10 @@ tracker_db_statement_bind_text (TrackerDBStatement *stmt,
int idx,
const gchar *value)
{
- g_return_if_fail (TRACKER_IS_DB_STATEMENT (stmt));
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL); */
+
+ g_return_if_fail (stmt != NULL);
TRACKER_DB_STATEMENT_GET_IFACE (stmt)->bind_text (stmt, idx, value);
}
@@ -410,7 +428,10 @@ tracker_db_statement_execute (TrackerDBStatement *stmt,
{
TrackerDBResultSet *result_set;
- g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL);
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL); */
+
+ g_return_val_if_fail (stmt != NULL, NULL);
result_set = TRACKER_DB_STATEMENT_GET_IFACE (stmt)->execute (stmt, error);
@@ -421,7 +442,10 @@ TrackerDBCursor *
tracker_db_statement_start_cursor (TrackerDBStatement *stmt,
GError **error)
{
- g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL);
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_STATEMENT (stmt), NULL); */
+
+ g_return_val_if_fail (stmt != NULL, NULL);
return TRACKER_DB_STATEMENT_GET_IFACE (stmt)->start_cursor (stmt, error);
}
@@ -439,7 +463,10 @@ tracker_db_cursor_rewind (TrackerDBCursor *cursor)
gboolean
tracker_db_cursor_iter_next (TrackerDBCursor *cursor)
{
- g_return_val_if_fail (TRACKER_IS_DB_CURSOR (cursor), FALSE);
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_CURSOR (cursor), FALSE); */
+
+ g_return_val_if_fail (cursor != NULL, FALSE);
return TRACKER_DB_CURSOR_GET_IFACE (cursor)->iter_next (cursor);
}
@@ -455,7 +482,10 @@ tracker_db_cursor_get_n_columns (TrackerDBCursor *cursor)
void
tracker_db_cursor_get_value (TrackerDBCursor *cursor, guint column, GValue *value)
{
- g_return_if_fail (TRACKER_IS_DB_CURSOR (cursor));
+ /* Removed for performance
+ g_return_if_fail (TRACKER_IS_DB_CURSOR (cursor)); */
+
+ g_return_if_fail (cursor != NULL);
TRACKER_DB_CURSOR_GET_IFACE (cursor)->get_value (cursor, column, value);
}
@@ -463,7 +493,10 @@ tracker_db_cursor_get_value (TrackerDBCursor *cursor, guint column, GValue *val
const gchar*
tracker_db_cursor_get_string (TrackerDBCursor *cursor, guint column)
{
- g_return_val_if_fail (TRACKER_IS_DB_CURSOR (cursor), NULL);
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_CURSOR (cursor), NULL); */
+
+ g_return_val_if_fail (cursor != NULL, NULL);
return TRACKER_DB_CURSOR_GET_IFACE (cursor)->get_string (cursor, column);
}
@@ -471,7 +504,10 @@ tracker_db_cursor_get_string (TrackerDBCursor *cursor, guint column)
gint
tracker_db_cursor_get_int (TrackerDBCursor *cursor, guint column)
{
- g_return_val_if_fail (TRACKER_IS_DB_CURSOR (cursor), -1);
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_CURSOR (cursor), -1); */
+
+ g_return_val_if_fail (cursor != NULL, -1);
return TRACKER_DB_CURSOR_GET_IFACE (cursor)->get_int (cursor, column);
}
@@ -479,7 +515,10 @@ tracker_db_cursor_get_int (TrackerDBCursor *cursor, guint column)
gdouble
tracker_db_cursor_get_double (TrackerDBCursor *cursor, guint column)
{
- g_return_val_if_fail (TRACKER_IS_DB_CURSOR (cursor), -1);
+ /* Removed for performance
+ g_return_val_if_fail (TRACKER_IS_DB_CURSOR (cursor), -1); */
+
+ g_return_val_if_fail (cursor != NULL, -1);
return TRACKER_DB_CURSOR_GET_IFACE (cursor)->get_double (cursor, column);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]