|P is for Practical|
Perl::Magick maxes my systems processor usageby MrCromeDome (Deacon)
|on May 08, 2003 at 18:44 UTC||Need Help??|
MrCromeDome has asked for the wisdom of the Perl Monks concerning the following question:
I've posted this same question to an Image::Magick forum, but figured if someone here had some insight, I'd appreciate it that much more.
I'm writing an image conversion in Perl. It takes single-page Group III TIFF images and writes them into a multi-page Group 4 TIFF file. Along the way, it creates new indexing information in our database so we can find the new image (as opposed to the old ones). The problem is that when Perl attempts to write the image to disk, my processor utilization hits 100%. When writing is complete, CPU usage drops and processing picks up till the next image write.
I have extracted enough of my code to illustrate my point:
As my program executes, it appears to hang for a REALLY long time after printing "Before". I checked the task manager at this point and see my processor usage at 100%. As soon as "After" prints, I check the task manager again and my CPU usage is back to an acceptable level. No errors are triggered, and the image I expect to be created is (with the proper number of pages). This type of behavior occurs even for one and two page documents, where the resulting image is only about 30-50k or so.
I am using the latest ActiveState Perl 5.8.0 and ImageMagick-5.5.6-Q8-windows (Q8 boasts less memory and CPU requirements than Q16) on Windows NT Server 4.0 SP 6.
Any insight is appreciated. Thank you!