-
Notifications
You must be signed in to change notification settings - Fork 126
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
converting image into buffer is too slow #32
Comments
Thank you, we will investigate ! |
We have an initial version with streams working internally and are now collecting data on performance of streams vs conversion to byte array. In the meantime, @gabrieleolmi, could you tell us about your setup, such as:
|
I've been using this repository for a short time so I don't know if the speed has gotten worse with the latest versions. In my opinion no, it is precisely the conversion to byte array that is slow. I tried images of various formats (jpg, png, webp) and in high resolution, slightly compressed (5/10/20 MB). The larger the image size, the longer it takes to convert to byte array. I use Node.js version 18 |
Hi 👋 I am experiencing the same problem when processing an 8MB image. I had to increase the response time in cloudfront up to 60 seconds to allow the image to be processed and returned without error but I see that sometimes it even takes longer than 60 seconds. |
I've have a 7mb, 7000x5000 JPEG that the lambda function seems to hang on when trying I ended up bumping the lambda task RAM up to 4096 (max ram used is only 1238 during this process) and the Lambda timeout to 5 minutes during testing, and converting this image to AVIF took 57.968 seconds. So upping the CF timeout is likely necessary but not ideal.
|
I did some tests with 10 MB images and noticed that the function
transformToByteArray
takes 0.5 seconds to 1 second to convert the image stream to a buffer. Sharp supports streams, could we try compressing images without turning them into buffers?image-optimization/functions/image-processing/index.mjs
Line 36 in 259f680
The text was updated successfully, but these errors were encountered: