⚡ Optimize blurry placeholder generation by removing redundant file read #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
💡 What:
Optimized
_11ty/blurry-placeholder.jsby removing the redundantimage-sizedependency. The code now uses the existingsharpinstance to retrieve image metadata (width/height) before processing.🎯 Why:
Previously,
sizeOf(fromimage-size) was called to get dimensions, and thensharpwas initialized to process the image. This caused the file header to be read twice.sharpcan provide the same metadata, allowing us to remove the extra file read and the dependency usage in this file.📊 Measured Improvement:
A benchmark script running 50 iterations showed a significant performance improvement:
The generated dimensions were verified to match exactly. Existing tests passed.
PR created automatically by Jules for task 7477716518848646894 started by @si