Skip to content

Commit fc7981c

Browse files
committed
Mark some idle jobs as low priority
This provides another improvement in startup performance, even with cold caches. The deferred code should now be completely absent from a startup profile.
1 parent 2550a56 commit fc7981c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

virtaal/controllers/welcomescreencontroller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33
#
44
# Copyright 2008-2011 Zuza Software Foundation
5+
# Copyright 2014 F Wolff
56
#
67
# This file is part of Virtaal.
78
#
@@ -55,8 +56,8 @@ def __init__(self, main_controller):
5556
def activate(self):
5657
"""Show the welcome screen and trigger activation logic (ie. find
5758
recent files)."""
58-
from gobject import idle_add
59-
idle_add(self.update_recent)
59+
import gobject
60+
gobject.idle_add(self.update_recent, priority=gobject.PRIORITY_LOW)
6061
self.view.show()
6162

6263
def open_cheatsheat(self):

virtaal/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
#
44
# Copyright 2008-2011 Zuza Software Foundation
5-
# Copyright 2013 F Wolff
5+
# Copyright 2013-2014 F Wolff
66
#
77
# This file is part of Virtaal.
88
#
@@ -49,7 +49,7 @@ def next_job():
4949

5050
if not self._todo:
5151
# No existing jobs, so start one
52-
gobject.idle_add(next_job)
52+
gobject.idle_add(next_job, priority=gobject.PRIORITY_LOW)
5353
self._todo.append((func, args))
5454

5555

virtaal/views/mainview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ class "GtkTreeView" style "show-rules"
189189
self._setup_key_bindings()
190190
self._track_window_state()
191191
self._setup_dnd()
192-
from gobject import idle_add
193-
idle_add(self._setup_recent_files)
192+
import gobject
193+
gobject.idle_add(self._setup_recent_files, priority=gobject.PRIORITY_LOW)
194194
self.main_window.connect('style-set', self._on_style_set)
195195

196196
def _create_dialogs(self):

0 commit comments

Comments
 (0)