assemble/assemble — pull request #313 by oncletom (2013-09-26 13:09:05+00:00)
Title: Accelerating build time

Hello fellows :-)

[I'm generating at the moment around 11K files per build](https://twitter.com/oncletom/status/383159462187790336) and it works well.
The build time is around 6/7 minutes and I'd like to reduce it.

For the purpose, I've setup a CC2 Amazon EC2 instance which are supposed to be fast as hell. The funny thing is I have the same build time. So definitely, it's not an I/O blocking problem.

Here are my insights:
* having large `data` in memory is slowing Handlebars compilation — I switched over JSON files from `require()` / `grunt.file.readJSON`
* `forEach` loops might be replaced `async.forEach` to parallelise tasks and unblock
* [assembling data loop](https://github.com/assemble/assemble/blob/master/tasks/assemble.js#L167)
* [assembling pages loop](https://github.com/assemble/assemble/blob/master/tasks/assemble.js#L211)
* [rendering pages loop](https://github.com/assemble/assemble/blob/master/tasks/assemble.js#L404)
* [path normalisation](https://github.com/assemble/assemble/blob/master/tasks/assemble.js#L469)

I think just that would boost performances. We could go more in depth in future steps.