I am working on simple templating enging for my work in javascript.. it needs to be very simple so i am not using Handlebars, moustache or any other robust templating engine available.
I keep reading the word 'PRECOMPILE' or 'COMPILE' template to boost performance. But i am not sure what exactly then mean by that. In my work i cache the template html in my object to avoid hitting the template html everytime.
It's a very simple function which mainly does the following
_template = _template.replace(/\{(.+?)\}/g, function(token, match, number, txt) {
return item[match];
});
item is the object which holds the value to be replaced.
Can someone please tell me what exactly it means when they(handlebars etc) say compile the template. ?