slow import

2009-12-06 Thread andres
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?

Thanks,

Andres

--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.




Re: slow import

2009-12-06 Thread Graham Higgins
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 6 Dec 2009, at 16:07, andres wrote:

 it seems like an unnecessary startup cost


A purely personal perspective:

I don't wish to appear discouraging but Pylons is not yet at 1.0 and I  
wouldn't want to see the dev team pressured to make optimizations  
which might later prove to be premature.

You're effectively asking people to devote effort and I suspect that  
would be better received if you could perhaps marshal some more  
detailed support for your argument that 150msec startup cost seems  
unnecessary, even slow?

If you have specific suggestions, I'm sure that Ben and the team would  
welcome proposals accompanied by code and tests.

Cheers,

Graham

http://www.linkedin.com/in/ghiggins




-BEGIN PGP SIGNATURE-

iEYEARECAAYFAksb4kcACgkQOsmLt1Nhivy/iACdGLXnkntW8eTrmXO5HOFqVORe
VZIAoOi1Jcl7myJt9xbEw7/czwlc1ywRiQCVAgUBSxviR1nrWVZ7aXD1AQIfcQP+
PsQPVPruGTgrLFo+DDLzJ9UH7Rv+2+n8LmmNnJw+F4UDcqGpcZzFcaNLA+2E5mUX
e/SXeJDhgNwUzzlE1mlfopVUnC8X/Et+5wjQskh1r9lnBC4AJ8y57MiyU8cQhvtW
0+FYaNp+D5OztB3pUw4HAmPzPgf5j+LJoA5N17d7YJY=
=c0uH
-END PGP SIGNATURE-

--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.




Re: slow import

2009-12-06 Thread Graham Dumpleton


On Dec 7, 3:07 am, andres and...@octopart.com 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.

Graham

--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.




Re: slow import

2009-12-06 Thread Noah Gift
On Sun, Dec 6, 2009 at 1:41 PM, Graham Dumpleton
graham.dumple...@gmail.com wrote:


 On Dec 7, 3:07 am, andres and...@octopart.com 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 pylons-disc...@googlegroups.com.
 To unsubscribe from this group, send email to 
 pylons-discuss+unsubscr...@googlegroups.com.
 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 pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.




Re: slow import

2009-12-06 Thread Mike Orr
On Sun, Dec 6, 2009 at 8:56 AM, Graham Higgins gjhigg...@gmail.com wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1


 On 6 Dec 2009, at 16:07, andres wrote:

 it seems like an unnecessary startup cost


 A purely personal perspective:

 I don't wish to appear discouraging but Pylons is not yet at 1.0 and I
 wouldn't want to see the dev team pressured to make optimizations
 which might later prove to be premature.

Actually, a solution is already built in.  More than half the Pylons
code and Routes code is backward compatibility for deprecated
features, and will be jettisoned in 1.0.  The plan is to release 0.10
and 1.0 simultaneously, with 0.10 containing the compatibility code
and 1.0 not. (Possibly 1.0 might not be ready by 0.10, but last I
heard it was going to be.)

Of course, much of the Pylons code is in the dependencies, which we
don't have direct control over.  But a quick summary of my package
directories shows Pylons at 632 KB (excluding the docs directory), and
the largest dependency being Paste at 3.6 MB.

Python does have a significant amount of overhead loading the standard
libraries at startup.  This has been noted a few times over the years,
but there's nothing we can do about it.  But the Python developers are
moving from a feature phase to an optimization phase, so this may be
addressed in the next year or two.

-- 
Mike Orr sluggos...@gmail.com

--

You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-disc...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.