Closed danielpietzsch closed 3 years ago
Hey, thanks so much for submitting this! I have a busy week coming up but I'll try to make some time to properly review and test this before merging it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Bad bot! So sorry I haven't got around to this yet 😱
No worries. I’m not in a rush.
Just throwing my hat in the ring here to have this PR considered, I have several hundred images on my site and it takes forever to rebuild making simple changes while dev'ing. I'll see if I can pull this down soon and test it as well!
Sweet thanks @brandonb927! I FINALLY got around to testing this on my sites, and I can't see any issues with it. @danielpietzsch this is a pretty sweet change btw - my biggest site only has 75 images but the build time dropped from 3.0 s to 2.5 s. I'm amazed it made that much of a difference!
I'll merge this PR to master now but hold off on releasing a new version for a little bit. @brandonb927 if you do end up testing this (and please don't feel obliged to!) I'd be keen to hear what kind of improvement it made to your build :)
@wildlyinaccurate Thanks for testing and merging! 😃
I can confirm that there is probably ~15% increase in speed when generating images from this 🎉 Thanks @danielpietzsch!
Hi @wildlyinaccurate,
This is my suggestion for improving the performance of a Jekyll site build when a lot of the site’s (resized) images have previously already been generated.
My site takes a lot of time to re-build, although no new images are being generated for the vast majority of those rebuilds: I currently have around 2900 images. And for each of those, 3 additional sizes are generated. A rebuild of that site without any new image-resize operations takes more than 140 seconds. With this modification, it only takes around 14 seconds.
The main thing I did for this was to open the original image using
.ping
instead of.read
..ping
omits the pixel data for the image resulting in a faster read and less memory usage. The full image – including pixel data – is only loaded, when resized versions actually need to be created.The tests pass.
Hope you like it! :-)
Update: Btw, I also did test full rebuilds of my site, generating resized versions of all 2900 images, to make sure it does not worsen that use-case. And the generation time remained between 14 and 15 minutes – as it did before with the master branch.
All the times listed are for my 2018 MBP 13” 2,3 Ghz Quad-Core i5.