Re: gtk application taking 6 seconds to load
- From: "Sid Kapoor" <sidkapoor2000 gmail com>
- To: "Michael L Torrie" <torriem chem byu edu>
- Cc: gtk-list gnome org
- Subject: Re: gtk application taking 6 seconds to load
- Date: Mon, 4 Feb 2008 13:18:33 +0530
hi michael,
As described in my previous post, I tried dividing the code into 7
different parts. But the problem still persists. The problem is not
exactly the same. Now after gtk_widget_show() of first part, it shows
a blank dialog within 2 seconds, But the other parts (with all the
widgets) are loaded after 5-6 seconds only.
This is not what I want. I want to see the fully loaded tabs as soon
as their gtk_widget_show(create_dialog_somehow()) is called.
I even tried the following lines to refresh the gtk_main() as soon as
gtk_widget_show() is called. This is how my main() function looks:
g_thread_init (NULL);
gdk_threads_init ();
gdk_threads_enter ();
gtk_init (&argc, &argv);
add_pixmap_directory ("/usr/share/pixmaps/ControlCenter/");
dialog1 = create_dialog1 ();
gtk_widget_show (dialog1);
if(gtk_events_pending())
gtk_main_iteration();
gtk_widget_show(create_display());
if(gtk_events_pending())
gtk_main_iteration();
gtk_widget_show(create_rest());
if(gtk_events_pending())
gtk_main_iteration();
gtk_main ();
gdk_threads_leave ();
return 0;
Thanks and Regards,
Siddharth Kapoor
On 1/31/08, Michael L Torrie <torriem chem byu edu> wrote:
> 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
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
--
Siddharth Kapoor
Sr. Software Engg., Monitor Group
Samsung India Software Center(SISC), Noida
Mobile - 9999169466
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]