(none) imager-devel
/ help / lists / applications / search /
 

Re: imager speed versus shell commands

From: Tony Cook (
03324@xyz.molar.is)
Date: Thu 13 Sep 2001 - 11:32:51 UTC


On Wed, 12 Sep 2001, David Lai wrote:

> Hi
>
> I have a job which scales an image to a smaller image, then scales the smaller
> image to an even smaller image. Using imager the code looks like this:
>
...
>
> I found that imager was 2X slower on a sample of 120 image.
> I would have expected the large
> amount of fork/exec and pipe overhead in the latter program to make it
> slower, and I thought Imager's routines are mostly done in C anyways.
> Any thoughts on this? Or am I not using Imager's routines correctly?

I've run some tests here against the version currently in CVS, and the
Imager version was slightly faster.

Two possible reasons:

a) current CVS has some minor efficiency improvements over 0.38, but not
enough of a difference to account for double the time[1]

b) you are using a multi-processor machine

The test code I used is in CVS in the bench directory.

The shell version prints "scale.sh.perl" and the Imager version
"scale.perl".

I got the following results on a single PIII/700:

scale.perl

real 0m48.728s
user 0m42.780s
sys 0m1.050s
scale.sh.perl

real 0m57.540s
user 0m48.180s
sys 0m2.640s

and the following results on a dual PII/400:

scale.perl
73.98user 1.27system 1:15.25elapsed 99%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (433major+42818minor)pagefaults 0swaps
scale.sh.perl
48.89user 4.69system 0:34.93elapsed 153%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (115558major+37729minor)pagefaults 0swaps

On a multi-processor machine the decompression, scaling, and compression
could run on different CPUs.

Of course it's possible that current CVS is simply faster than 0.38, in
which case your problem will be solved for the next release :)

Tony

[1] there was an extra function call made for each get or set of a pixel