There are many issues in Sugar regarding performance, but one of the more visible to the user is how much time the activities take to start. This is not so evident in newer hardware, but is important in XO-1. Is so important than by example, Peru will use sugar 0.94 instead of a newer because o this.
I was doing some testing with the main activities: https://docs.google.com/spreadsheet/ccc?key=0As_jQJX0Me6XdDI2clFpX1FFRHhKMHVFZGkyakdST2c&usp=drive_web#gid=0 (These measures were done in a XO-1) I first blamed to the port from gtk2 to gtk3 of the big regressions in performance, but after looking with a little of detail, some can be solved easily. One of the arguments of the dynamic bindings was a better startup time due to not need initialize all the libraries until is needed use them. Then the import should be lighter than before. Looks like that is not so true. In the case of Write activity, I was able to reduce the start up in 7 or 8 seconds, just delaying the gstreamer initialization [1], and 1 or 2 seconds more delaying two other imports. In the case of Browse activity, just delaying the import of Evince libraries to the moment when a pdf is opened, improve the start up time in 13 seconds (patch attached). The start up time is even better than the version in 0.94 I think this work of identify big libraries used only in specific moments, can be applied in other cases. Gonzalo [1] http://git.sugarlabs.org/write/mainline/commit/5dd843cf415d0c65e2927540225b0098f2b71cd0 [2] http://git.sugarlabs.org/write/mainline/commit/dba223f5749f510735692a06f246acee30ab50bf
From 0f71dc1c1aec9dd915612e052dc9577fe5b1d024 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard <godi...@gmail.com> Date: Fri, 8 Nov 2013 11:35:36 -0300 Subject: [PATCH] Delay Evince import until is needed to improve activity startup time This change improve startup time in a XO-1 from 31 segs to 18 segs. Signed-off-by: Gonzalo Odiard <gonz...@laptop.org> --- activity/activity.info | 2 +- pdfviewer.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/activity/activity.info b/activity/activity.info index c3af6df..b570c45 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,6 +1,6 @@ [Activity] name = Browse -activity_version = 155 +activity_version = 155.1 bundle_id = org.laptop.WebActivity icon = activity-web exec = sugar-activity webactivity.WebActivity -s diff --git a/pdfviewer.py b/pdfviewer.py index ce0244c..7f2838f 100644 --- a/pdfviewer.py +++ b/pdfviewer.py @@ -17,14 +17,11 @@ import os import logging import tempfile -import threading from gettext import gettext as _ from gi.repository import GObject from gi.repository import Gtk from gi.repository import GLib -from gi.repository import EvinceDocument -from gi.repository import EvinceView from gi.repository import WebKit from sugar3.graphics.toolbarbox import ToolbarBox @@ -56,6 +53,10 @@ class EvinceViewer(Gtk.Overlay): self._uri = uri + # delay Evince import until is needed to improve activity startup time + from gi.repository import EvinceDocument + from gi.repository import EvinceView + # Create Evince objects to handle the PDF in the URI: EvinceDocument.init() self._doc = EvinceDocument.Document.factory_get_document(uri) @@ -64,6 +65,8 @@ class EvinceViewer(Gtk.Overlay): self._model.set_document(self._doc) self._view.set_model(self._model) + self._EVINCE_MODE_FREE = EvinceView.SizingMode.FREE + self._view.connect('external-link', self.__handle_link_cb) self._model.connect('page-changed', self.__page_changed_cb) @@ -173,15 +176,15 @@ class EvinceViewer(Gtk.Overlay): current_page < self._doc.get_n_pages() - 1 def zoom_original(self): - self._model.props.sizing_mode = EvinceView.SizingMode.FREE + self._model.props.sizing_mode = self._EVINCE_MODE_FREE self._model.props.scale = 1.0 def zoom_in(self): - self._model.props.sizing_mode = EvinceView.SizingMode.FREE + self._model.props.sizing_mode = self._EVINCE_MODE_FREE self._view.zoom_in() def zoom_out(self): - self._model.props.sizing_mode = EvinceView.SizingMode.FREE + self._model.props.sizing_mode = self._EVINCE_MODE_FREE self._view.zoom_out() def get_pdf_title(self): -- 1.8.1.4
_______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel