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(a)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
Show replies by date
Average time required for loading 60 Kerneloopses()
Before : 2.2s
After : 1.4s
This commit has performance impact in all cases.
Related to rhbz#963054
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gnome_abrt/problems.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/gnome_abrt/problems.py b/src/gnome_abrt/problems.py
index 575e377..ea6318e 100644
--- a/src/gnome_abrt/problems.py
+++ b/src/gnome_abrt/problems.py
@@ -184,6 +184,10 @@ class Problem:
return source.get_items(self.problem_id,
'component',
'executable',
+ 'cmdline',
+ 'count',
+ 'type',
+ 'last_occurrence',
'time',
'reason')
--
1.8.2.1
Average time required for loading 60 Kerneloopses()
Before : 1.4s
After : 1.1s
This commit has performance impact in all cases.
Related to rhbz#963054
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gnome_abrt/problems.py | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/src/gnome_abrt/problems.py b/src/gnome_abrt/problems.py
index ea6318e..db1064e 100644
--- a/src/gnome_abrt/problems.py
+++ b/src/gnome_abrt/problems.py
@@ -64,6 +64,8 @@ class ProblemSource(object):
pass
class Problem:
+ INITIAL_ELEMENTS = ['component', 'executable', 'cmdline',
'count', 'type',
+ 'last_occurrence', 'time', 'reason']
class Submission:
URL = "URL"
@@ -134,15 +136,19 @@ class Problem:
.format(self.problem_id))
return {}
+ if self.data is None:
+ self.data = {}
+
items = self.source.get_items(self.problem_id, *args)
- for key, value in items.items():
- self.data[key] = value
+ for item in args:
+ self.data[item] = items.get(item)
return items
def __getitem__(self, item, cached=True):
if self.data is None:
- self.data = self._get_initial_data(self.source)
+ # Load initial problem data into cache
+ self.__loaditems__(*Problem.INITIAL_ELEMENTS)
if item == 'date':
return datetime.datetime.fromtimestamp(float(self['time']))
@@ -180,17 +186,6 @@ class Problem:
def __len__(self):
return 1
- def _get_initial_data(self, source):
- return source.get_items(self.problem_id,
- 'component',
- 'executable',
- 'cmdline',
- 'count',
- 'type',
- 'last_occurrence',
- 'time',
- 'reason')
-
def refresh(self):
if self._deleted:
logging.debug("Not refreshing deleted problem '{0}'"
@@ -198,7 +193,7 @@ class Problem:
return
logging.debug("Refreshing problem
'{0}'".format(self.problem_id))
- self.data = self._get_initial_data(self.source)
+ self.data = None
self.submission = None
self.source.notify(ProblemSource.CHANGED_PROBLEM, self)
--
1.8.2.1
Pushed. Thanks.
--
Richard Marko