Hi,

if you are importing lots of modules, you can get the startup time down by
not importing the modules at the top of a file, but at the place where you
need it in a function.
Note that modules are loaded only once, so subsequent import commands will
have no effect.

Example:
instead of this:

  import os

  def foo():
      print os.listdir()


you can write this:

  def foo():
    import os
    print os.listdir()


Cheers,
Martin


2007/11/9, Jesse Guardiani <[EMAIL PROTECTED]>:
>
> Hello,
>
> Is there anything that can be done about python startup time?
> I recently wrote a very simple little pygtk + glade application that is
> less than 110 lines of code and it takes between 5 and 9 seconds to start
> up.
>
> http://www.guardiani.us/projects/tip_calc/browser/trunk/src/tip_calc/tip_calc.py
> Any way to get that startup time down?
>
>
> --
> Jesse Guardiani
> Software Developer / Sys Admin
> [EMAIL PROTECTED]
> _______________________________________________
> maemo-developers mailing list
> maemo-developers@maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>
>
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to