Page 1 of 1

Major performance problem...

Posted: 2011-10-01T13:31:10-07:00
by malch
I have simple Perl/ImageMagick script that runs nicely on my Windows box.

However, when run on my CentOS server the performance is horrible. Each execution requires around 120MB of memory and 2.5 seconds of CPU.

It consumes about one tenth of those resources under Windows (much more reasonable).

Any suggestions?

www:/home/malch> convert -version
Version: ImageMagick 6.7.2-9 2011-10-01 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

I've just installed the above version; it was even worse under 6.6.9-9 which I was running previously.

#!/usr/bin/perl
$IMPATH = '/etc/httpd/fonts';
$ENV{MAGICK_CONFIGURE_PATH} = $IMPATH;
$text = "Here is the message";
$font = 'JIMMY1';
$size = 36;
use Image::Magick;
my $image = Image::Magick->new;
$image->Set(quality=>100);
$image->Set(type=>'truecolor');
$image->Set(size=>'2000x1000');
$image->ReadImage('xc:white');
$image->Annotate(x=>1000, y=>400, align=>'center', font=>$font, pointsize=>$size, fill=>'black', text=>$text);
$image->Trim();
($width, $height) = $image->Get('width', 'height');
$image->Set(type=>'truecolor');
$image->Set(magick=>'JPEG');
my $blob = $image->ImageToBlob();
undef $image;
#print "Content-Type: image/jpeg\r\n\r\n";
binmode (STDOUT);
print $blob;
exit;

Re: Major performance problem...

Posted: 2011-10-01T15:24:28-07:00
by magick
Try turning off OpenMP. Rerun the configure command line script and add the --disable-openmp to the command line. After you build and install, convert -version should not list OpenMP as a feature.

Re: Major performance problem...

Posted: 2011-10-01T19:21:43-07:00
by malch
Thank you.

--disable-openmp has helped a lot.

Performance is now much more reasonable. Still looks a bit slow compared to my Windows box but this is something I can live with quite happily.

Re: Major performance problem...

Posted: 2011-10-09T14:21:25-07:00
by Weertolon
And how can I speed up the performance?

Re: Major performance problem...

Posted: 2011-10-09T14:52:25-07:00
by fmw42
What is your problem exactly? What command is running slow? What version of IM and platform are you running?

It is hard to tell from so little information!

Also it is generally best not to tack onto some one else's post. One should start one's own post.

Please clarify your problem and someone will likely be able to help further.