[gnome-photos] application: Try to speed up Babl conversions on the first run
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] application: Try to speed up Babl conversions on the first run
- Date: Mon, 20 Feb 2017 22:18:10 +0000 (UTC)
commit dd3c9181b7171ce9274065842570623b7eff53b4
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Feb 2 02:35:02 2017 +0100
application: Try to speed up Babl conversions on the first run
Profiling the various pixel conversion code paths for a given source
and destination format might take enough time to make a visible
difference in some cases. For example, when sliding out the previews
of the magic filters. Newer versions of Babl keep the outcome of the
profiling in a persistent cache. Hence, it is only a problem when the
conversions are used for the first time after installing a new Babl
version.
This problem can be further reduced by populating Babl's cache before
a performance-critical operation takes place.
This is done in an idle handler after the main window is created so
that the user interface continues to show up as fast as possible. The
assumption being that just showing the main window doesn't require any
performance-critical conversions, and the time spent profiling won't be
noticeable if it is done right after the window is shown.
src/photos-application.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 666aeb4..41ce776 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -45,6 +45,7 @@
#include "photos-export-dialog.h"
#include "photos-export-notification.h"
#include "photos-filterable.h"
+#include "photos-gegl.h"
#include "photos-glib.h"
#include "photos-item-manager.h"
#include "photos-main-window.h"
@@ -117,6 +118,7 @@ struct _PhotosApplication
TrackerExtractPriority *extract_priority;
gboolean main_window_deleted;
guint create_miners_count;
+ guint init_fishes_id;
guint use_count;
guint32 activation_timestamp;
gulong source_added_id;
@@ -554,6 +556,17 @@ photos_application_create_miners (PhotosApplication *self)
static gboolean
+photos_application_gegl_init_fishes_idle (gpointer user_data)
+{
+ PhotosApplication *self = PHOTOS_APPLICATION (user_data);
+
+ self->init_fishes_id = 0;
+ photos_gegl_init_fishes ();
+ return G_SOURCE_REMOVE;
+}
+
+
+static gboolean
photos_application_sanity_check_gegl (PhotosApplication *self)
{
gboolean ret_val = TRUE;
@@ -653,6 +666,9 @@ photos_application_create_window (PhotosApplication *self)
self->main_window_deleted = FALSE;
self->factory = photos_thumbnail_factory_dup_singleton (NULL, NULL);
+ if (self->init_fishes_id == 0)
+ self->init_fishes_id = g_idle_add (photos_application_gegl_init_fishes_idle, self);
+
g_application_hold (G_APPLICATION (self));
tracker_extract_priority_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
@@ -1609,6 +1625,12 @@ photos_application_shutdown (GApplication *application)
refresh_miner_ids_size = g_hash_table_size (self->refresh_miner_ids);
g_assert (refresh_miner_ids_size == 0);
+ if (self->init_fishes_id != 0)
+ {
+ g_source_remove (self->init_fishes_id);
+ self->init_fishes_id = 0;
+ }
+
g_clear_pointer (&self->refresh_miner_ids, (GDestroyNotify) g_hash_table_unref);
G_APPLICATION_CLASS (photos_application_parent_class)->shutdown (application);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]