ImagesToBlob is slow
Posted: 2015-04-22T14:19:01-07:00
Hi,
I'm building a small web server that crops/resizes gif(note: I'm using JMagick and Java). It works great but I'm having 2 issues.
1. I use coalesce and optimizeLayers method for resizing gif. The issue is converting resized gif(ImagesToBlob) to byte array is extremely slow(takes 3-4 sec for 2MB gif with 60 frames), I believe it's related to 'coalesce' operation. I even noticed it in command line.
Is it normal behavior? Can it be optimized?
2. The above issue is much worser in multi-thread environment.
Here is time of resizing a single gif:
Single thread: 1357ms
Multi thread: 96267ms(4 threads)
I have OpenMP disabled and set MAGICK_TMPDIR to a big disk.
My system info:
2.7 GHz Intel Core i7
16 GB 1600 MHz DDR3
Appreciate for any comments or help.
I'm building a small web server that crops/resizes gif(note: I'm using JMagick and Java). It works great but I'm having 2 issues.
1. I use coalesce and optimizeLayers method for resizing gif. The issue is converting resized gif(ImagesToBlob) to byte array is extremely slow(takes 3-4 sec for 2MB gif with 60 frames), I believe it's related to 'coalesce' operation. I even noticed it in command line.
Code: Select all
time convert cat.gif -coalesce -layers optimize cat-1.gif
real 0m2.880s
user 0m2.725s
sys 0m0.109s
2. The above issue is much worser in multi-thread environment.
Here is time of resizing a single gif:
Single thread: 1357ms
Multi thread: 96267ms(4 threads)
I have OpenMP disabled and set MAGICK_TMPDIR to a big disk.
My system info:
2.7 GHz Intel Core i7
16 GB 1600 MHz DDR3
Appreciate for any comments or help.