[gnome-settings-daemon] Create a reference to a GnomePnpIds object to speed up loading



commit d8c158e74caea048dea5a38232bd87c1c7a78a70
Author: Richard Hughes <richard hughsie com>
Date:   Fri Sep 30 10:48:11 2011 +0100

    Create a reference to a GnomePnpIds object to speed up loading
    
    During loading, the singleton GnomePnpIds is created and destroyed 3 times
    during startup. This means that the pnp.ids is loaded from disk each time and
    re-parsed.
    
    Whilst loading it from disk subsequent times is fast, parsing is not.
    By keeping a reference at daemon startup ensures it's only loaded and unloaded
    once per daemon startup-shutdown.
    
    This speeds up startup of gnome-settings-daemon by about 400ms.

 gnome-settings-daemon/gnome-settings-manager.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gnome-settings-daemon/gnome-settings-manager.c b/gnome-settings-daemon/gnome-settings-manager.c
index c528ef1..13faeba 100644
--- a/gnome-settings-daemon/gnome-settings-manager.c
+++ b/gnome-settings-daemon/gnome-settings-manager.c
@@ -30,6 +30,9 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+#include <libgnome-desktop/gnome-pnp-ids.h>
+
 #include "gnome-settings-plugin-info.h"
 #include "gnome-settings-manager.h"
 #include "gnome-settings-profile.h"
@@ -64,6 +67,7 @@ struct GnomeSettingsManagerPrivate
         GDBusNodeInfo              *introspection_data;
         GDBusConnection            *connection;
         GSettings                  *settings;
+        GnomePnpIds                *pnp_ids;
         GSList                     *plugins;
 };
 
@@ -429,6 +433,9 @@ gnome_settings_manager_start (GnomeSettingsManager *manager,
                 goto out;
         }
 
+        g_debug ("loading PNPIDs");
+        manager->priv->pnp_ids = gnome_pnp_ids_new ();
+
         gnome_settings_profile_start ("initializing plugins");
         manager->priv->settings = g_settings_new (DEFAULT_SETTINGS_PREFIX ".plugins");
 
@@ -456,6 +463,9 @@ gnome_settings_manager_stop (GnomeSettingsManager *manager)
 
         g_object_unref (manager->priv->settings);
         manager->priv->settings = NULL;
+
+        g_object_unref (manager->priv->pnp_ids);
+        manager->priv->pnp_ids = NULL;
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]