We use GM to do image compressing, and observe a significant performance difference between zoom and sample functions, which we suppose to do the same thing.
When using zoom function for a 68k image, a process could consume all the cpu time for all cores(12 core, 2.4G Hz machine), the throughput is 65/seconds, response time is 469 ms on average, load by top command is around 11, cpu usage is close to 100%
When using sample function in the same environment, 24 process work together providing throughput close to 1000/seconds, response time is 37 ms on average, load by top command is around 3, cpu usage fluctuates between 50% and 80%
the official document for these two functions is very simple as below:
sample Resize image by using pixel sampling algorithm:
void sample ( const Geometry &geometry_ )
zoom Zoom (resize) image to specified size:
void zoom ( const Geometry &geometry_ )
the effects after the image processing are similar, but the difference is huge.
Could anyone explain the different circumstances of using these two functions, since we might choose sample over zoom because of the performance issue
Further, could anyone tell me why zoom is so cpu-time-consuming.