Right, as you can see it only loads gobject introspection stuff. If you do the import after any other gi import it shouldn't even do that, because those modules will have been loaded already. It should basically not touch the disk at all... Which is why it's totally weird that moving the import helps startup time.<div>
<br></div><div>Did you try to repeat your timings dropping kernel memory cache every time? (unless they was taken that way already). Otherwise they are not going to be very accurate.</div><div><br></div><div>Did you try to measure the time it takes to do the import? Something simple like this in the unpatched activity code should be enough</div>
<div><br></div>import logging<br>start = time.time()<div>--- here are the two imports ---<br><div>logging.error(time.time() - start)<br><div><br>On Saturday, 9 November 2013, Gonzalo Odiard wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In my system, using<br>
<br>
strace -e trace=open,close,read,write,connect,accept -p pid<br>
<br>
in another terminal, when I do:<br>
<br>
from gi.repository import EvinceDocument<br>
<br>
I see:<br>
<br>
open("gi.so", O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("gimodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("gi.py", O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("gi.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/bin/gi.so", O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/bin/gimodule.so", O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/bin/gi.py", O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/bin/gi.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/gi.so", O_RDONLY) = -1 ENOENT (No such file<br>
or directory)<br>
open("/usr/lib64/python2.7/gimodule.so", O_RDONLY) = -1 ENOENT (No<br>
such file or directory)<br>
open("/usr/lib64/python2.7/gi.py", O_RDONLY) = -1 ENOENT (No such file<br>
or directory)<br>
open("/usr/lib64/python2.7/gi.pyc", O_RDONLY) = -1 ENOENT (No such<br>
file or directory)<br>
open("/usr/lib64/python2.7/plat-linux2/gi.so", O_RDONLY) = -1 ENOENT<br>
(No such file or directory)<br>
open("/usr/lib64/python2.7/plat-linux2/gimodule.so", O_RDONLY) = -1<br>
ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/plat-linux2/gi.py", O_RDONLY) = -1 ENOENT<br>
(No such file or directory)<br>
open("/usr/lib64/python2.7/plat-linux2/gi.pyc", O_RDONLY) = -1 ENOENT<br>
(No such file or directory)<br>
open("/usr/lib64/python2.7/lib-tk/gi.so", O_RDONLY) = -1 ENOENT (No<br>
such file or directory)<br>
open("/usr/lib64/python2.7/lib-tk/gimodule.so", O_RDONLY) = -1 ENOENT<br>
(No such file or directory)<br>
open("/usr/lib64/python2.7/lib-tk/gi.py", O_RDONLY) = -1 ENOENT (No<br>
such file or directory)<br>
open("/usr/lib64/python2.7/lib-tk/gi.pyc", O_RDONLY) = -1 ENOENT (No<br>
such file or directory)<br>
open("/usr/lib64/python2.7/lib-dynload/gi.so", O_RDONLY) = -1 ENOENT<br>
(No such file or directory)<br>
open("/usr/lib64/python2.7/lib-dynload/gimodule.so", O_RDONLY) = -1<br>
ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/lib-dynload/gi.py", O_RDONLY) = -1 ENOENT<br>
(No such file or directory)<br>
open("/usr/lib64/python2.7/lib-dynload/gi.pyc", O_RDONLY) = -1 ENOENT<br>
(No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/__init__.so", O_RDONLY) =<br>
-1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/__init__module.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/__init__.py", O_RDONLY) = 5<br>
open("/usr/lib64/python2.7/site-packages/gi/__init__.pyc", O_RDONLY) = 6<br>
read(6, "\3\363\r\nn;\324Pc\0\0\0\0\0\0\0\0\3\0\0\0@@\0\0s\311\0\0\0d\0"...,<br>
4096) = 2118<br>
read(6, "", 4096) = 0<br>
close(6) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_gi.so", O_RDONLY) = 7<br>
open("/usr/lib64/python2.7/site-packages/gi/_gi.so", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\216\0\0\0\0\0\0"...,<br>
832) = 832<br>
close(8) = 0<br>
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 8<br>
close(8) = 0<br>
open("/lib64/libgirepository-1.0.so.1", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\177\0\2167\0\0\0"...,<br>
832) = 832<br>
close(8) = 0<br>
open("/lib64/libgobject-2.0.so.0", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\253\340j7\0\0\0"...,<br>
832) = 832<br>
close(8) = 0<br>
open("/lib64/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\240\341i7\0\0\0"...,<br>
832) = 832<br>
close(8) = 0<br>
open("/lib64/libpyglib-gi-2.0-python.so.0", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\32\0\0\0\0\0\0"...,<br>
832) = 832<br>
close(8) = 0<br>
open("/lib64/libgmodule-2.0.so.0", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\21<br>
k7\0\0\0"..., 832) = 832<br>
close(8) = 0<br>
open("/lib64/librt.so.1", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\"`h7\0\0\0"...,<br>
832) = 832<br>
close(8) = 0<br>
open("/lib64/libgio-2.0.so.0", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\1ck7\0\0\0"...,<br>
832) = 832<br>
close(8) = 0<br>
open("/lib64/libgthread-2.0.so.0", O_RDONLY|O_CLOEXEC) = 8<br>
read(8, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\6\240j7\0\0\0"...,<br>
832) = 832<br>
close(8) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/__init__.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/__init__module.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/__init__.py", O_RDONLY) = 8<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/__init__.pyc",<br>
O_RDONLY) = 9<br>
read(9, "\3\363\r\nn;\324Pc\0\0\0\0\0\0\0\0\3\0\0\0@\0\0\0s\364\6\0\0d\0"...,<br>
4096) = 4096<br>
read(9, "\1\22\2\6\1\34\1\17\1\f\1\t\1\t\1\20\1\24\2\6\1\4\2\t\2\36\1\r\1$\1\3"...,<br>
4096) = 4096<br>
read(9, "\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t\1\t"...,<br>
4096) = 177<br>
read(9, "", 4096) = 0<br>
close(9) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/sys.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/sysmodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/sys.py",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/sys.pyc",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/__init__.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/__init__module.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/__init__.py", O_RDONLY) = 9<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/__init__.pyc", O_RDONLY) = 10<br>
read(10, "\3\363\r\nm;\324Pc\0\0\0\0\0\0\0\0\2\0\0\0@\0\0\0sG\3\0\0d\0"...,<br>
4096) = 3103<br>
read(10, "", 4096) = 0<br>
close(10) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/_glib.so", O_RDONLY) = 10<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/_glib.so",<br>
O_RDONLY|O_CLOEXEC) = 11<br>
read(11, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260f\0\0\0\0\0\0"...,<br>
832) = 832<br>
close(11) = 0<br>
close(10) = 0<br>
close(9) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/_gobject.so", O_RDONLY) = 9<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/_gobject.so",<br>
O_RDONLY|O_CLOEXEC) = 10<br>
read(10, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\223\0\0\0\0\0\0"...,<br>
832) = 832<br>
close(10) = 0<br>
close(9) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/constants.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/constantsmodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/constants.py",<br>
O_RDONLY) = 9<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/constants.pyc",<br>
O_RDONLY) = 10<br>
read(10, "\3\363\r\nn;\324Pc\0\0\0\0\0\0\0\0\2\0\0\0@\0\0\0s\207\2\0\0d\0"...,<br>
4096) = 2041<br>
read(10, "", 4096) = 0<br>
close(10) = 0<br>
close(9) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/propertyhelper.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/propertyhelpermodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/propertyhelper.py",<br>
O_RDONLY) = 9<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/propertyhelper.pyc",<br>
O_RDONLY) = 10<br>
read(10, "\3\363\r\nn;\324Pc\0\0\0\0\0\0\0\0\3\0\0\0@\0\0\0s.\1\0\0d\0"...,<br>
4096) = 4096<br>
read(10, "\0\0_type_from_pythont\4\0\0\0typet\f\0\0"..., 4096) = 4096<br>
read(10, "ges/gi/_gobject/propertyhelper.p"..., 4096) = 3001<br>
read(10, "", 4096) = 0<br>
close(10) = 0<br>
close(9) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/signalhelper.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/signalhelpermodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/signalhelper.py",<br>
O_RDONLY) = 9<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/signalhelper.pyc",<br>
O_RDONLY) = 10<br>
read(10, "\3\363\r\nn;\324Pc\0\0\0\0\0\0\0\0\4\0\0\0@\0\0\0s\225\0\0\0d\0"...,<br>
4096) = 4096<br>
read(10, "\0\0\6\0\0\0C\0\0\0s\316\0\0\0|\2\0r\31\0|\1\0\fr\31\0|\2\0j"...,<br>
4096) = 4096<br>
read(10, "\0\0(\3\0\0\0R\22\0\0\0R$\0\0\0R#\0\0\0(\0\0\0\0(\1\0\0\0"...,<br>
4096) = 1273<br>
read(10, "", 4096) = 0<br>
close(10) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/inspect.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/inspectmodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/inspect.py",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_gobject/inspect.pyc",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
close(9) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/option.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/optionmodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/option.py", O_RDONLY) = 9<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/option.pyc", O_RDONLY) = 10<br>
read(10, "\3\363\r\nm;\324Pc\0\0\0\0\0\0\0\0\t\0\0\0@\0\0\0s\6\1\0\0d\0"...,<br>
4096) = 4096<br>
read(10, "\0Z\4\0d\3\0\204\0\0Z\5\0d\4\0\204\0\0Z\6\0d\7\0d\5\0\204\1\0Z"...,<br>
8192) = 8192<br>
read(10, "\0\0\0Ro\0\0\0R|\0\0\0R}\0\0\0R\177\0\0\0R\204\0\0\0R8\0\0"...,<br>
4096) = 460<br>
read(10, "", 4096) = 0<br>
close(10) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/sys.so", O_RDONLY) =<br>
-1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/sysmodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/sys.py", O_RDONLY) =<br>
-1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/sys.pyc", O_RDONLY)<br>
= -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/optparse.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/optparsemodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/optparse.py",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/optparse.pyc",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/gi.so", O_RDONLY) =<br>
-1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/gimodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/gi.py", O_RDONLY) =<br>
-1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/_glib/gi.pyc", O_RDONLY) =<br>
-1 ENOENT (No such file or directory)<br>
close(9) = 0<br>
close(8) = 0<br>
close(7) = 0<br>
close(5) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/repository/__init__.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/repository/__init__module.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/repository/__init__.py",<br>
O_RDONLY) = 5<br>
open("/usr/lib64/python2.7/site-packages/gi/repository/__init__.pyc",<br>
O_RDONLY) = 7<br>
read(7, "\3\363\r\nl;\324Pc\0\0\0\0\0\0\0\0\3\0\0\0@@\0\0sL\0\0\0d\0"...,<br>
4096) = 378<br>
read(7, "", 4096) = 0<br>
close(7) = 0<br>
open("/usr/lib64/python2.7/site-packages/gi/importer.so", O_RDONLY) =<br>
-1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/importermodule.so",<br>
O_RDONLY) = -1 ENOENT (No such file or directory)<br>
open("/usr/lib64/python2.7/site-packages/gi/importer.py", O_RDONLY) = 7<br>
open("/usr/lib64/python2.7/site-packages/gi/importer.pyc", O_RDONLY) = 8<br>
read(8, "\3\363\r\nn;\324P<br>
Gonzalo<br>
<br>
On Sat, Nov 9, 2013 at 1:52 AM, Gonzalo Odiard <<a href="javascript:;" onclick="_e(event, 'cvml', 'gonzalo@laptop.org')">gonzalo@laptop.org</a>> wrote:<br>
> Can you explain me how you verified the library was not loaded?<br>
><br>
> Gonzalo<br>
><br>
><br>
> On Fri, Nov 8, 2013 at 8:16 PM, Daniel Narvaez <<a href="javascript:;" onclick="_e(event, 'cvml', 'dwnarvaez@gmail.com')">dwnarvaez@gmail.com</a>> wrote:<br>
>><br>
>> It's not just theory, I verified importing evince doesn't even cause the<br>
>> library to be loaded. I don't have a XO 1 to check what is going on myself,<br>
>> unfortunately.<br>
>><br>
>> My suggestion is to *not* checkin this kind of workaround without any clue<br>
>> about why the change helps, and especially to *not* suggest people should do<br>
>> the same kind of change in other activities.<br>
>><br>
>> That said, I don't maintain any of the activities so feel free to go ahead<br>
>> if you think it's a sensible approach (sigh).<br>
><br>
><br>
</blockquote></div></div></div><br><br>-- <br>Daniel Narvaez<br><br>