JSRocksHQ / harmonic

The next static site generator
http://harmonicjs.com/
MIT License
282 stars 26 forks source link

Parallelize build #154

Closed UltCombo closed 9 years ago

UltCombo commented 9 years ago

Testing on my machine, this branch is up to 10% faster than master when building the JS Rocks website. @jaydson please test.

The next step (in a future PR) would be to parallelize harmonic.clean and the in-memory generation of the file contents, and then output the resulting files right after clean finishes. I'm leaving this for the future as it may require splitting the CSS preprocessing and posts/pages/index/categories generation in two functions each, or some smarter trickery in order to achieve this parallelism.

UltCombo commented 9 years ago

Oh, I just noticed we can replace most for...ins inside async functions with parallel async functions for even better perf.

jaydson commented 9 years ago

Great job @UltCombo ! I just tried and it seems work very fast. My blog has 153 posts and the build time stays between 700ms and 800ms, that's awesome!

UltCombo commented 9 years ago

Added one more optimization, now this branch is up to 33% faster than master (testing on JS Rocks). There are more optimizations to be done.

UltCombo commented 9 years ago

Added one last optimization for now, I estimate this branch to be about 35% faster than master now.

jaydson commented 9 years ago