[GNOME-ABRT PATCH 1/3] Improve data caching

Jakub Filak jfilak at redhat.com
Thu Jul 4 12:36:13 UTC 2013


Average time required for loading 60 Kerneloopses()
Before: 6.8s
After : 2.2s

But this patch still doesn't make start up faster for the worst case
when all of the problems are different and none of them has a desktop
entry.

Related to rhbz#963054

Signed-off-by: Jakub Filak <jfilak at redhat.com>
---
 src/gnome_abrt/application.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/gnome_abrt/application.py b/src/gnome_abrt/application.py
index 910e76a..8517eaa 100644
--- a/src/gnome_abrt/application.py
+++ b/src/gnome_abrt/application.py
@@ -121,6 +121,7 @@ def find_application(component, executable, cmdline):
                    (executable, compare_executable),
                    (component, compare_component)]
 
+    # explore the cache in the first step
     for pred in lookupnames:
         if not pred[0]:
             continue
@@ -128,6 +129,11 @@ def find_application(component, executable, cmdline):
         if pred[0] in __globa_app_cache__:
             return __globa_app_cache__[pred[0]]
 
+    # no cache entry was found, try to find corresponding desktop entry
+    for pred in lookupnames:
+        if not pred[0]:
+            continue
+
         theme = Gtk.IconTheme.get_default()
         for dai in Gio.DesktopAppInfo.get_all():
             if pred[1](pred[0], dai):
@@ -154,4 +160,11 @@ def find_application(component, executable, cmdline):
                                                         icon=icon)
                 return __globa_app_cache__[pred[0]]
 
-    return Application(executable, name=component)
+    app = Application(executable, name=component)
+
+    # cache by cmdline because package and component can provide many
+    # applications but cmdline looks like pretty unique information
+    if cmdline:
+        __globa_app_cache__[cmdline] = app
+
+    return app
-- 
1.8.2.1



More information about the Crash-catcher mailing list