baryshev / ect

Fastest JavaScript template engine with embedded CoffeeScript syntax
http://ectjs.com
MIT License
626 stars 69 forks source link

Make .render() actually async #75

Open nfour opened 10 years ago

nfour commented 10 years ago

So I noticed today that render() is calling a readFileSync() equivalent (I'm assuming because the built in fs.readFileSync is slower?). My use case is loading the templates into memory first so that I can run a css inliner and other formatters, for email templating. The result is that loading 20 templates takes about 1.5 minutes due to them being sequentially loaded. In theory it would take about -10 seconds if render was async.

Is there a reason why you're not reading files via the async function? I'm confused, because I imagine that would be the best for a performance focused templater.