On Sun, Dec 6, 2009 at 1:41 PM, Graham Dumpleton <[email protected]> wrote: > > > On Dec 7, 3:07 am, andres <[email protected]> wrote: >> Hi, >> >> I've been looking into performance bottlenecks in my pylons app and I >> noticed that importing the pylons module itself takes >150 msec. It >> might seem pedantic to be worried about 150 msec, but it seems like an >> unnecessary startup cost. Have you guys considered ways of making >> pylons modules faster to import? > > Certain modules in Python standard library themselves are slow to > import. Thus, not necessarily a Pylons issue. > > Start out by seeing how long it takes to import 'cgi' module to begin > with and you may see what I mean. > >>>> import time >>>> def func(): > ... a = time.time() > ... import cgi > ... print time.time() -a > ... >>>> func() > 0.0814950466156 > > So, that is 80ms alone on my couple of year old iMac.
My guess is this is probably not a huge issue for most pylons apps, but I did happen to be looking at mercurial's source code today for something unrelated and found this: http://selenic.com/repo/hg-stable/file/2770d03ae49f/mercurial/demandimport.py Neat little hack. > > Graham > > -- > > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > > > -- Thanks, Noah -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
