Did you turn on caching and use getTemplate?  Makes a big difference.

WILL

On 4/4/06, Ståle Undheim <[EMAIL PROTECTED]> wrote:
> I am currently working on a project where we are evaluating wheter to
> use Velocity or WebMacro. I did some performance test in relation to how
> we intend to use either of the parsing engines.
>
> We are making a Web UI framework, and its very much based on nesting
> components. IE. you have a frame, and inside it you have various
> sections, which again contains components. So you end up with nesting
> alot of components and their associated template files.
>
> In order to test things the way we used it, I made a simple Class that
> would have an associated VM/WM file, and recurse several levels deep.
>
> Full code can be found here:
> http://apollo.coretrek.com/~staaleu/VelocityPerformance.tar.gz
>
> Dependent packages are here:
> http://apollo.coretrek.com/~staaleu/
>
> There is a slight difference in code from WM 1.1 to 2.0, commented on
> line 91 of NestedObject.java
>
> The basic constructor of the class is as follows:
>
> ________________________________
>     public NestedObject() {
>         this(0);
>     }
>
>     private NestedObject(int level) {
>         _level = level;
>         for (int i=0; i<level; i++) {
>             _indentation+="  ";
>         }
>         if (_level == LEVELS) {
>             _nested = Collections.EMPTY_LIST;
>         }
>         else {
>             _nested = new ArrayList(CHILD_COUNT);
>             for (int i = 0; i < CHILD_COUNT; i++) {
>                 _nested.add(new NestedObject(_level + 1));
>             }
>         }
>     }
> ________________________________
>
> So creating a NestedObject, creates a tree of child objects. The Class
> has an associated VM/WM file that looks like this:
> ________________________________
> $this.getIndentation()START LEVEL $this.Level
> #foreach ($obj in $this.Nested)
> $obj
> #end
> $this.getIndentation()END   LEVEL $this.Level
> ________________________________
>
> Basically recursing several levels deep.
>
> For the WebMacro part, I use the Macro interface, which means I get an
> outputstream in to write each object to. For Velocity I had to use the
> toString() method, so a seperate String would be created for each level.
>
> Here are the test results as I got them:
> WebMacro 1.1 init memoryConsumption: 1346552
> Run: 0, memoryConsumption: 926968, time: 439ms, size: 67179
> Run: 10, memoryConsumption: 467648, time: 54ms, size: 67179
> Run: 20, memoryConsumption: 468128, time: 54ms, size: 67179
> Run: 30, memoryConsumption: 468320, time: 54ms, size: 67179
> Run: 40, memoryConsumption: 468320, time: 64ms, size: 67179
> Run: 50, memoryConsumption: 468128, time: 56ms, size: 67179
> Run: 60, memoryConsumption: 468320, time: 66ms, size: 67179
> Run: 70, memoryConsumption: 468320, time: 57ms, size: 67179
> Run: 80, memoryConsumption: 468128, time: 55ms, size: 67179
> Run: 90, memoryConsumption: 468320, time: 54ms, size: 67179
> Run: 100, memoryConsumption: 468320, time: 54ms, size: 67179
> Total time for WebMacro: 7416
>
> WebMacro 2.0 init memoryConsumption: 456808
> Run: 0, memoryConsumption: 713456, time: 1668ms, size: 67179
> Run: 10, memoryConsumption: 608160, time: 145ms, size: 67179
> Run: 20, memoryConsumption: 608208, time: 346ms, size: 67179
> Run: 30, memoryConsumption: 608160, time: 157ms, size: 67179
> Run: 40, memoryConsumption: 580208, time: 154ms, size: 67179
> Run: 50, memoryConsumption: 608160, time: 146ms, size: 67179
> Run: 60, memoryConsumption: 608208, time: 1534ms, size: 67179
> Run: 70, memoryConsumption: 608400, time: 144ms, size: 67179
> Run: 80, memoryConsumption: 580208, time: 149ms, size: 67179
> Run: 90, memoryConsumption: 608160, time: 143ms, size: 67179
> Run: 100, memoryConsumption: 608208, time: 146ms, size: 67179
> Total time for WebMacro2: 20406
>
> Velocity 1.4 init memoryConsumption: 2280416
> Run: 0, memoryConsumption: 1872776, time: 2063ms, size: 67179
> Run: 10, memoryConsumption: 1729616, time: 1074ms, size: 67179
> Run: 20, memoryConsumption: 1707664, time: 1037ms, size: 67179
> Run: 30, memoryConsumption: 1707624, time: 1076ms, size: 67179
> Run: 40, memoryConsumption: 1707624, time: 1414ms, size: 67179
> Run: 50, memoryConsumption: 1707624, time: 1018ms, size: 67179
> Run: 60, memoryConsumption: 1707624, time: 1037ms, size: 67179
> Run: 70, memoryConsumption: 1707576, time: 1152ms, size: 67179
> Run: 80, memoryConsumption: 1707624, time: 1090ms, size: 67179
> Run: 90, memoryConsumption: 1707624, time: 1501ms, size: 67179
> Run: 100, memoryConsumption: 1707640, time: 1032ms, size: 67179
> Total time for Velocity: 130396
>
> Please note that WebMacro 2.0 produces errornous output, but thats not
> for this list.
>
> Am I using Velocity totally wrong? Is there interfaces that allows me to
> nest objects and have good performance?
>
> Here is the full code for the NestedObject, which handles the output:
> http://apollo.coretrek.com/~staaleu/NestedObject.java.txt
>
> --
> Ståle Undheim
> Systemutvikler
>
> CoreTrek
> Tlf.:   +47 51 97 85 97
> E-post: [EMAIL PROTECTED]
> WEB:    www.coretrek.no
>
> "Simple is beautiful"
>
>
>
>


--
Forio Business Simulations

Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to