Search code examples
jqueryajaxknockout.jsjsrenderjtemplates

Choosing the fastest template plugin for data table


I recently changed our asp.net gridviews (which worked with update panels) to HTML tables, using jquery-Ajax and templating using jtemplates. The performance improvement was huge!!! (on the server side I am using a generic httphandler). One performance problem I am dealing with occurs on Firefox, because of the jtemplate plugin. Somehow it takes F.F to render a 20 rows template up to 3 seconds!!! (on I.E or chrome it takes about 100ms). Which is the preferred templating plugin, when my goal is mainly simplicity and performance? I am trying jsrender, which is fast, but not documented enough(I had some problems doing things inside a for loop). Knockoutjs seems great but is pretty sofisticated and I am afraid of performance problems as well. Thanks!!!


Solution

  • Fore pure templating, JsRender is awesome. JsRender is really fast. Check out the perf page here: http://jsperf.com/dom-vs-innerhtml-based-templating/395

    It compares the various templating engines rendering data, and JsRender fared very well on all browsers. JsRender has no DOM dependency, no jQuery dependency (though you can certainly use it with it ... I do) and is pure string based rendering.

    if you go that route, here is an article I wrote on getting started: http://jpapa.me/clientIn1204

    If you wanted more of a framework for data binding that has templates, Knockout would be excellent. But for pure perf, JsRender is a great choice.