tags:

views:

529

answers:

2

hi, i have read this article ScuttGu

for making use of User control to make Client side templates.

and this one too

Ecnosia

are they the same, regarding performance ? thanks in advanced.

+3  A: 

OK Encosia's (Dave Ward) example uses the JQuery plug-in JTemplate to do its works. ScottGu's utilizes more of the ASP.Net stack.

That said, ScottGu's sample lacks some fineness.

As for performance...I hate that question. Too many variables. But...

ScottGu's example will be moving more bits over the wire. You are essentially sending the entire html output to the browser via a web service call.

Encosia's example is sending the rawest form of data possible (JSON) to the browser, and then turning it into html using JQuery/JTemplate/Javascript.

In theory Encosia's example will perform better. Less data moved over the wire, should be less server load as well. But it will be more browser work (nominal at best here).

That said, for small amounts of data, I doubt it would matter either way.

Chris Brandsma
really thanks a lot for the answer, and i think i understand what you mean by performance, but what you mean by it lack Fitness ?if you don't mind can you list some of the variables ?
Not Fitness -- fineness. More fine tuned. ScottGu's approach is a sledgehammer, Dave Ward's is a exacto-knife. But they both get the job done.I'm not sure what variables you would be looking for here.
Chris Brandsma
thanks for your reply and excuse me for confusing fineness with fitness, i did not have my coffee :)
+1  A: 

Both samples use JSON, which you get for free when you use .NET Web Services. So the amount of data which goes over the wire will be the same.

On the client-side, don't know about about the client-side performance of the library generated by ScriptServiceAttribute, but the differences between doing it yourself and using that library should probably be marginal.

The Ecnosia example uses jTemplates. jTemplates can give you a good boost in performance when it comes to fetching large lists and displaying them in repeating sections (like html tables).


reply to devmania:

Scott's version applies the template server-side, and then sends html+data formatted to the client. The html here can be a real overhead (in case of a table, think about all the tr's, td's, style properties, spacing between tags...).

jTemplates renders client-side. The data is send in the more data efficient and compact JSON format (just the data, not the html). The template that jTemplates has to read is also much smaller, as it only contains the definitions for first row.

Yes, it is much easier to render server-side. Server-side can also be more flexible in rendering, as you can access data sources which you don't have on the client-side.

Client-side can in many cases be more efficient. Further, with some javascript, you can make it as flexible as server-side rendering. But, I reckon complex client-side rendering would take more time to develop.

taoufik
thanks man for the reply, but you can also do the templating like in scutt gu with list view, and like you said both fetch data through jason, so in scutt technique you get thee template ready, with jquery you do it by your self, but would it really matter to use Jtemplate as the data is already received, where is the boost am i missing something ?
thanks again for replying me, i think it is totally clear for me right now :)