cyrilwanner / next-optimized-images

🌅 next-optimized-images automatically optimizes images used in next.js projects (jpeg, png, svg, webp and gif).
MIT License
2.21k stars 93 forks source link

[Canary] Performance issues optimizing the images #199

Open Nick-Mazuk opened 4 years ago

Nick-Mazuk commented 4 years ago

I'm experiencing some similar performance issues as mentioned in https://github.com/cyrilwanner/next-optimized-images/issues/169 but with the most current build.

I have gotten the same error occasionally, but more often, images will just take forever to build during development. Small images are near-instant, though anything above 500x500 pixels seems to take a few minutes for each image. I even just clocked a single image taking 12 minutes to process.

Any ideas about what could be causing the slow optimization times?

Just to rule out a few possibilities:

If the slow build times are unavoidable, here are a few suggestions to help for development:

  1. Make it so optimizing images doesn't block the website render
  2. While images are optimizing, display a default "image is still optimizing" image
  3. When the image finishes optimizing, replace the temp image with the actual image

I literally have no idea how feasible this would be, so if it's not possible, no worries! And of course, this would only be for development.

Thanks for everything!

nelsonreitz commented 3 years ago

Can confirm, I'm hitting netlify timeout build time (25min) with just a few images on 3.0.0-canary.10.

Nick-Mazuk commented 3 years ago

For anyone reading this thread now, I ended up switching to the new next/image component in NextJS 10.0.0 https://nextjs.org/docs/api-reference/next/image

Been using it for about a week and it's working wonderfully.

TheThirdRace commented 3 years ago

NextJs solution is far from perfect and has plenty of troubles:

We do need an alternative because NextJs solution isn't rosy as soon as you dig a little deeper.