[Helma-user] Javascript Template Engine, Sub Templates
Juerg Lehni
juerg at scratchdisk.com
Mon Dec 11 20:54:58 CET 2006
Hi Walter,
The benchmarks I was refering to were made during the development of
the first version, then later I was only measuring speed improvements
through changes in the code relative to previous versions of
Template.js.
What I was measuring when comparing with Helma Skins was not
compilation time but execution time once Templates where compiled and
cached. These were very comparable, and I think they became only
slightly slower now with added features like prefix / suffix,
encoding, etc.
Templates are much slower than Skins during compilation / parsing
though. But this is only a problem when creating them dynamically on
the fly...
Does that answer your question?
Maybe it is time to do proper benchmarking of the current version
with a real world application?
Best,
Jürg
Am 5 Dec 2006 um 16:32 schrieb VividVisions, Walter Krivanek:
> Hi Jürg,
>
> are there any up-to-date benchmarks regarding the performance of
> using JSTL Templates in contrast to Helma Skins?
> What is your testing setup?
>
>> - prefix / suffix / default handling for loops: Are they added to
>> each iteration or the whole output?
>
> I'd expect them to replace/be added to the whole output.
>
>
> Thanks a lot!
> Walter
>
>
> Am 08.11.2006 um 02:30 schrieb Juerg Lehni:
>
>> I added the possibility of sub templates to my template engine today,
>> as a proof of concept:
>>
>> http://dev.helma.org/Wiki/JavaScript+Template+Engine/
>>
>> The syntax and naming is not fixed, but so far it works well for me,
>> so I thought I should share it.
>>
>> This also had the side-effect that templates can now be created from
>> strings like this:
>>
>> new Template(str);
>>
>> I think it should be very easy to create a JS only version from the
>> current code that could run on the client side.
>>
>> One discussion that is still open is the problem with closing tags
>> for nested content (</%>). In my email from 27.10.06 that remained
>> unreplied so far I wrote about this, among many other open template
>> questions:
>>
>> http://grazia.helma.at/pipermail/helma-dev/2006-October/003166.html
>>
>> - Nested content: So far it has been said they should use <% end %>
>> instead of </%> as the end tag, for more consistency. I just realized
>> today why this is not as easy as we hoped, and why I have come up
>> with the current scheme. Look for example at this situation:
>>
>> <% foreach (value in list) %>
>> <% value.macro %>
>> Some HTML
>> <% end %>
>>
>> It would be good to hear reactions about this problem, and also about
>> the other questions in my post.
>>
>> Bellow some examples of sub templates. Comments are welcome.
>>
>> Jürg
>>
>> ---
>>
>> Definition:
>>
>> <% template "name">
>> This is a sub-template. It can call <% macros %> and write <%=
>> param.value %> too!
>> </%>
>>
>> Rendering:
>>
>> <% render "name" value="variables" %>
>>
>> Rendering of normal templates:
>>
>> <% this.render "name" foo="bar" %>
>>
>> Definition and rendering into a variable in one command:
>>
>> <% set "text">
>> Render this text into 'name'. <% macros %> can be called.
>> </%>
>>
>> This can now be used like a normal variable, and for example be
>> passed as
>> the default value in another macro:
>>
>> <%= text %>
>>
>> <% do_something default=text %>
>> _______________________________________________
>> Helma-user mailing list
>> Helma-user at helma.org
>> http://helma.org/mailman/listinfo/helma-user
>>
>
> _______________________________________________
> Helma-user mailing list
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user
>
More information about the Helma-user
mailing list