On Monday 25 May 2009 11:51:05 Antoine Pitrou wrote:
> On May 25, 11:40 am, "Diez B. Roggisch" <[email protected]> wrote:
> > > I'm not sure why all of PIL, genshi, mako, tempita, pygments (!), the
> > > whole paste and tw.core subhierarchies, among others, have to be
> > > loaded like that.
> >
> > And the gain of lazyfying that so that it happens when the first request
> > hits the system would be what?
>
> It's not about lazyfying, it's about loading only what's needed.
> There's no reason to load three different template engines, the PIL
> library, the pygments package, and whatever else, if your application /
> never/ makes use of them.
> (as for pygments, perhaps it's needed in debug mode for the nice
> traceback display? regardless, it shouldn't be loaded unconditionally)

But this *is* lazyfying, aka making imports at the moment you need them.

And that's a non-trivial task to do, especially since much of the imports are 
not directly tg-driven, but instead via 3rd-party-packages which would need 
to be adapted, too.

Then there is the question who's going to decide when it's ok to import what - 
via configuration? So instead of making usage of a ToscaWidget that happens 
to use a template-engine you so far didn't use simple, you make it more 
complicated by needing to somehow propagate a global config setting 
downwards.

> > I still don't see the issue - do you actually have *problems* serving a
> > TG app with reasonable speed and scalability?
>
> Not concretely (the app I'm working on has a couple of requests per
> minute only). But I know that if I had a performance-critical app, I'd
> be very suspicious about TG's memory requirements.
>
> Loading lots of modules has a real cost. Besides inflating memory
> requirements (and potentially decreasing CPU caches/TLBs efficiency),

Please, we are talking about python here, not hand-optimized LAPACK code. And 
resident modules loaded but not actively used do degrade CPU caches in exact 
what way?

> it also, as I showed, has a dramatic impact on the cost of garbage
> collection.
> (Python 2.7 will mitigate the latter a bit, but not make it disappear)

All of this without a compelling usecase for optimizing - sorry, but you won't 
get far with this anywhere unless you show a real impact for a real 
use-case - not some premature optimization guesswork. 

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to