Open tunggad opened 13 years ago
Yes, there is room for surer for optimization. Given my tight schedule, they're not on my immediate plan.
The specific case you mentioned, it's not that bad. I only create an instance for each piece of code invoking the tag, not for each invocation. For example, a tag invoked in a for loop uses the same instance, no matter how many iterations of the loop.
I see in the generated java codes that everywhere/everytime when a template is invoked, then a new instance of it is created, even when the same template is used twice within the same calling method (calling template). The following codes show it:
Actually, the tow instances _myTemplate4 and _myTemplate6 could/should be reused?
BTW: Im just thinking abit futher, we see very often, that some representation logics actually only do READ-access to the passed paremater, and it would be a futher enorm optimization if we had something like STATIC TEMPLATE. They dont have own states, --> should be Thread-safe. They only have a static render method, where one can pass the parameter into, just like a static utils/service method. So we can reuse such static templates globally --> save cpu cycle for instances creation, save ram. What do you think?