[OLPC-devel] Re: [sugar] Re: pygtk performance issue

Mike Hearn mike
Wed Sep 6 09:29:32 EDT 2006

On Wed, 06 Sep 2006 14:26:32 +0200, Marco Pesenti Gritti wrote:
> The reduced test case I attached to the mail starting this thread is 
> doing only "open".
> On the OLPC:
> Total "import gtk" time : 0.9 secs
> 500 opens with my testcase: 0.35 secs
> (import gtk cause around 500 opens)
> Note that I'm ignoring all the "stat". Still, this seem to be a good 
> part of the startup time.

Profiles from my own system are here:


I think the open() related parts would be:

53        0.5516  vmlinux- do_page_fault
32        0.3330  vmlinux- __d_lookup

One issue I see - your test case is written in Python itself, whereas the
Python VM is written in C. On my system this makes a big difference:

mike at linux:/tmp> time ./opentest

real    0m0.136s
user    0m0.000s
sys     0m0.076s
mike at linux:/tmp> time python ./opentest.py
10000 open: 0.507028

real    0m0.677s
user    0m0.456s
sys     0m0.112s

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>

int main()
    char fname[1024];

    for (int i = 0; i < 10000; i++)
        sprintf(fname, "/tmp/foo.%04d", random() % 9999);
        open(fname, O_RDONLY);

thanks -mike

More information about the Sugar-devel mailing list