On Mar 21, 2:28 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > I think I'll still persue the approach of statically creating the > > widget list, but somehow taking a copy of the widgets at runtime as a > > mutable set of widgets, it should be a fair bit faster then > > contstructing them each time. I think that most of the hit in > > constructing a widget is in the kid template compilation anyway. > > But the template will be compiled and cached. Not much of a penalty there. >
Hmm, there certainly seems to be. As a test I'm creating a list of 10 widgets in the request handler (but not displaying them). Just creating the widgets every time adds about 30 ms to each request. If in each of these widgets I then pass template=None, then a negligble amount of time is added to the original request time for the construction of the same 10 widgets each time. Looking through the widget code I see that the only call that would be left out in this test would be the load_kid_template call in the base widget class. I would have thought that in creating separate instances of the widgets at runtime the kid template would have to be loaded (and discarded) every time with the widget. I think that kid only disk- caches templates that are already stored on the disk as .kid files. This is not the case for most of the widgets. Unless I'm wrong again of course..... Regards, Gary. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

