On 3/13/02 7:48 AM, "Christian Trutz" <[EMAIL PROTECTED]> wrote:
> Am Mittwoch, 13. M�rz 2002 11:19 schrieben Sie: >> On 3/13/02 2:26 AM, "Christian Trutz" <[EMAIL PROTECTED]> wrote: >>> Hello Velocity community, >>> [SNIP] >>> >>> Is this a good idea??? >> >> Not sure - I mean, JSP does this :) > > JSP, JSP ... ??? ... ah I know, this pre-historical stuff from Sun ;-) It seems it ain't dead yet :) >> >>> Is anybody working on a Velocity template compiler? >> >> 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? > > OK, the JSP like compilation has perhaps only little improvement, perhaps the > only improvement in the situation when you must scan/parse the same template > file many times. Has Velocity a cache-like mechanism for this? Of course. We may have been born at night, but it wasn't *last* night... ;-> [SNIP] >> >> 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. > > What is a "real-world" template? 10K, 100K, 1M velocity code? I have seen some big ones from people doing heavy XML processing. But a template that does a bit of looping, flow control (#if/#else), etc is representative of the common use patterns of VTL (the Velocity Template Language) >The merge > process is also dependent from the context (loops with 10 iterations and > loops with 10^7 iterations ...). I think there are 2 points for improvements: > > 1) run the scan/parse process only once and compile the template, this can be > performant, if you must scan/parse many times the same template ... We do that. > 2) merge(Context,Writer) method, JSP-like compiled code is in the O-notation > the same as walking thru AST nodes ;-) but I think it's a difference in the > constants ... So we don't care as long as the constant isn't that huge - which I don't think it will be. > I will make some profile experiments with little, medium and large template > files. That would be great. >> >>> The AST (see JJTree) implemets the visitor pattern and any AST node has a >>> render method ... why? Is rendering with a visitor not so good? >> >> We use the tree for different things, and the render() approach works quite >> well for us. Visitor is good, and we do use it for things, sometimes... > > OK sorry ;-) it was only an academic question ... No worries... I've used the visitor very effectively in other things liike this I have done - allowed me to do specialized initializations and such w/o having to define it in specific node methods... -- Geir Magnusson Jr. [EMAIL PROTECTED] System and Software Consulting Java : the speed of Smalltalk with the simple elegance of C++... -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
