On 3/13/02 12:55 PM, "Jason van Zyl" <[EMAIL PROTECTED]> wrote:
> On Wed, 2002-03-13 at 05:19, Geir Magnusson Jr. wrote:
>
>>
>> I guess the question is - is there any point to doing this? :) It's not
>> clear to me what kind of real performance improvements can be realized by
>> compiling, because once the template is intepreted, it's bytecode, right?
>
> The AST is bytecode, but I believe the compiled form of a template would
> be different in that the reflection would be removed and if types place
> in the context were immutable then I believe the compiler would make
> things faster.
I agree, but this is in fact removing functionality.
>
>> I think the motivation for starting a compiler was when we believed that JSP
>> was incredibly fast and Velocity was slow. Since thing, we have proved to
>> ourselves many times that Velocity is comparable in performance to JSP,
>> which is of course, compiled from generated Java code.
>
> I think velocity is comparable to jakarta implementations of JSP but I'm
> not sure there has been many comparisons with other JSP implementations.
> I am still willing to bet 10 bucks (american bucks ;-)) that the
> compiler would make a significant improvement. But some internal changes
> to velocity would be required in order to make this actually work. A
> core that stated immutable types in the context which would allow for
> real complication with the option to allow mutable types if you wished.
> Hashtables are convenient and I know people use them but I think that
> allow mutable types in the context actually promotes bad design.
How's that? When you see
$foo.bar
There is no contract about what class foo is, and how bar is accessed....
>
>> I would be interested in understanding if there really is potential for
>> improvement doing this, or if we are just making things more complex with no
>> real benefit.
>>
>> In the case above, you took what is now basically
>>
>> for(int j=0; j<numchildren; j++)
>> {
>> getChild(j).render();
>> }
>>
>> And unwound the loop into the two writes
>>
>> I am sure there is performance improvement there and it could significant in
>> such a trivial case (or other optimal situations), but the question is how
>> that improvement scales for real-world templates.
>
> I believe the expansion would be greater than this and the AST wouldn't
> be reference at all in the final compiled version of the template.
>
> I am honestly not going to be tackling any sort of compiler until
> Turbine is finished so I may never be working on a compiler ;-)
Turbine 3 is cool
--
Geir Magnusson Jr. [EMAIL PROTECTED]
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>