Skip to content

⚡ Parallelize image format generation#35

Open
si wants to merge 4 commits intomainfrom
perf-parallel-image-generation-6722412414781195535
Open

⚡ Parallelize image format generation#35
si wants to merge 4 commits intomainfrom
perf-parallel-image-generation-6722412414781195535

Conversation

@si
Copy link
Owner

@si si commented Feb 17, 2026

Parallelized setSrcset calls for JPEG, AVIF, and WebP generation in _11ty/img-dim.js. This allows sharp to process multiple image formats concurrently, reducing the overall time spent on image processing during the build.
Verified with a benchmark script that generates multiple formats for a sample image.
Ensured that failure in mandatory format (JPEG) still stops the process, while failures/unsupported optional formats are handled correctly (skipped).


PR created automatically by Jules for task 6722412414781195535 started by @si

Parallelizes the generation of JPEG, AVIF, and WebP image formats using `Promise.all` in `_11ty/img-dim.js`.
This improves build performance by processing multiple image formats concurrently instead of sequentially.
Correctly handles fallback logic and ensures mandatory formats (JPEG/PNG) block execution on failure while optional formats (AVIF/WebP) are handled gracefully.

Co-authored-by: si <18108+si@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 17, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
11ty 87a41c8 Feb 17 2026, 11:44 AM

google-labs-jules bot and others added 3 commits February 17, 2026 11:31
Introduces a `concurrencyLimit` (10) for page-level image processing in `dimImages`.
This balances the increased per-image concurrency (parallel format generation) with per-page concurrency to prevent resource exhaustion (e.g., file descriptors, memory) in CI environments.
Maintains the performance benefit of parallel format generation while ensuring stability.

Co-authored-by: si <18108+si@users.noreply.github.com>
Reduces `concurrencyLimit` in `_11ty/img-dim.js` from 10 to 1.
While individual image formats (JPEG, AVIF, WebP) are still generated in parallel (3x concurrency per image), pages are now processed sequentially.
This drastic reduction is necessary to prevent resource exhaustion (e.g., file descriptors, memory) observed in the CI environment (Cloudflare Workers builds).

Co-authored-by: si <18108+si@users.noreply.github.com>
Modifies `processImage` in `_11ty/img-dim.js` to execute the mandatory (JPEG/PNG) image generation sequentially.
Only after the fallback image succeeds are the optional formats (AVIF, WebP) generated in parallel.
This strategy reduces peak concurrency and resource usage in CI environments (Cloudflare Workers builds) while still offering performance benefits for the slower, optional formats.
Also ensures "fail fast" behavior: if the fallback generation fails, no resources are wasted attempting to generate optional formats.

Co-authored-by: si <18108+si@users.noreply.github.com>
@netlify
Copy link

netlify bot commented Feb 17, 2026

Deploy Preview for sijobling ready!

Name Link
🔨 Latest commit 87a41c8
🔍 Latest deploy log https://app.netlify.com/projects/sijobling/deploys/6994545b04a9c900073660f4
😎 Deploy Preview https://deploy-preview-35--sijobling.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Feb 17, 2026

Deploy Preview for si-jobling ready!

Name Link
🔨 Latest commit 87a41c8
🔍 Latest deploy log https://app.netlify.com/projects/si-jobling/deploys/6994545b1107560008c63a4a
😎 Deploy Preview https://deploy-preview-35--si-jobling.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant