garann / template-chooser

Tool to help select the right template engine for a project.
http://garann.github.com/template-chooser/
476 stars 66 forks source link

Underscore templates are quite speedy as of 1.3.3. #3

Closed braddunbar closed 12 years ago

braddunbar commented 12 years ago

with blocks are optional in underscore 1.3.3, yielding large performance improvements.

garann commented 12 years ago

The standard I was using for "one of the fastest" was the top three fastest from a different jsperf that appeared to include largest number of engines (http://jsperf.com/javascript-templating-shootoff-extended/22). If you want to add Underscore without "with" to that larger list and see if it comes out on top, that would definitely be good info to have.

braddunbar commented 12 years ago

Will do. Thanks for the response @garann!

braddunbar commented 12 years ago

Here you go. I just added a case for underscore without the with block. It's definitely on par with doT (slightly slower, but far and away faster than the rest). Thanks again!

kirbysayshi commented 12 years ago

There were several things failing in the shootout, including engines being overwritten through variable conflicts (the test marked "resig" was actually using blueimp, doU was using doT, jsRender was completely broken, Template was "cheating" by using an internal cache...). I've updated it to the best of my ability:

http://jsperf.com/javascript-templating-shootoff-extended/25

braddunbar commented 12 years ago

Thanks @kirbysayshi!

braddunbar commented 12 years ago

@garann Ping! What do you think of the jsperf results? I don't mind if you leave it as is, just wanted to make sure you were aware of the recent speed improvements to _.template. :)

garann commented 12 years ago

@braddunbar Hey, sorry for the delay. I did check it out, and it looks like a huge difference in most browsers. But going by @kirbysayshi's jsperf, it looks like it's not quite fastest, yet. Though it is far ahead of most others.. Eh, what the heck. Pulling it in, but I reserve the right to go back to strictly top three if this ends up making things really confusing. ;)

braddunbar commented 12 years ago

Thanks @garann!