Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render templates in parallel. #3277

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

fqueze
Copy link
Contributor

@fqueze fqueze commented May 5, 2024

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).

@shivjm
Copy link

shivjm commented May 20, 2024

This would be extremely helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants