Re: gtk application taking 6 seconds to load



Sid Kapoor wrote:
> I have a solution, just wanted to share it with you people whether that will
> be correct or not. In my application, there are 7 different tabs with all
> the tabs are having lots of widgets. So as the application starts up, it
> loads all the widgets before returning from the function in interface.c . So
> instead of loading all the 7 tabs in the same function, I am thinking of
> dividing the code in 7 parts and showing the front tab first, with the other
> tabs loading subsequently, This will virtually create an effect as if my
> application has taken 1/7th the time it is taking now.
> 
> The idea seems nice on paper, but will it work?? I just wanted to confirm
> before proceeding, as its a really big project, and will take a lot of
> effort to re-arrange the code.

That all depends on if the time is being spent "realizing" the widgets
(which happens when the widgets are set to "show").  If this is the
case, then maybe that will improve things.  But if the time is spent
simply building the widget trees, then splitting it up the way you
describe doesn't seem like it will do any good.  Maybe you should
consider creating the contents of the tabs on demand.  Many GTK programs
I have seen use the following pattern:

def some_callback():
    if not dialog: #if the dialog hasn't been created
        #call some function that creates the dialog and
        #sets up the callbacks for it
        dialog=create_dialog_somehow()

    dialog.show()
    dialog.run()
    do something with return results


> 
> Thanks in advance.
> Siddharth Kapoor
> 
> On Jan 31, 2008 4:55 PM, Michael L Torrie <torriem chem byu edu> wrote:
> 
>> Sid Kapoor wrote:
>>> hi all,
>>>
>>> I am having a customised linux distribution installed on a thin client
>>> with the following configuration.
>>>
>>> AMD LX800
>>> 128MB RAM
>>> Xorg version 7.2gtk-2.0 libraries
>>>
>>> I have made a gtk application (size 830 kB) using glade-2 to generate
>>> code for my application. When I run this gtk application on my
>>> customized linux distribution, it takes almost 6 seconds to show up.
>>> This lapse of 6 seconds is very irritating. Can anyone suggest how to
>>> reduce this "boot-up" time of my application.
>> Do all GTK apps have this bootup delay?  gedit, for example?  Is there a
>> lot of disk activity during this 6 second startup?  If you switch to the
>> default GTK theme does that help?
>>
>> One thing that sometimes helps (if you can parse through the noise) is
>> to use strace to get a dump of all the system calls.  This can help see
>> if it's file opens that slow you down.
>>
>>> One more thing. Here as I have said, I am using the code generation
>>> feature of glade-2. There is another approach to make gtk apps. and
>>> that is by using the XML file made by glade. Does both these
>>> approaches differ in loading time of my application?
>> Using glade XML files certainly is the recommended way to go.  However I
>> doubt it will make your app start up any faster, maybe a tiny bit
>> slower.  So after you've found out the cause of your slow starts, then
>> you can move to using the XML file directly and see what happens.
>>
>>> Thanks in advance.
>>>
>>> Regards,
>>> Siddharth Kapoor
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> gtk-list mailing list
>>> gtk-list gnome org
>>> http://mail.gnome.org/mailman/listinfo/gtk-list
>>
>> --
>> Michael Torrie
>> Assistant CSR, System Administrator
>> Chemistry and Biochemistry Department
>> Brigham Young University
>> Provo, UT 84602
>> +1.801.422.5771
>>
>> _______________________________________________
>> gtk-list mailing list
>> gtk-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtk-list
>>
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list


-- 
Michael Torrie
Assistant CSR, System Administrator
Chemistry and Biochemistry Department
Brigham Young University
Provo, UT 84602
+1.801.422.5771



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]