fqueze


Render templates in parallel.

For Eleventy sites with templates using shortcodes that do a lot of computation, rendering the template is the part of the build that takes the longest. This part is done sequentially.

This PR makes it happen in parallel, limiting the concurrency to the core count.

Example profiles, using the 11ty-website site as an example for benchmarking:

I zoomed all profiles to the time range when templates are rendered.

The saving is larger for my own website, going from 10s to 3.4s to render my templates.

Rendering in parallel helps mostly for cases where the templates trigger async code that can perform some of its work off main thread. This is the case for resizing images with eleventy-img. This would also enable using workers to move heavy JS computations of shortcodes off of the main thread (without this PR, moving work to a worker is pointless as the main thread is blocked waiting for the result).