convert(PDF=>PNG) is extremely slow on Windows,fast on Linux

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.

Re: convert(PDF=>PNG) is extremely slow on Windows,fast on L

Postby FBR » 2012-03-22T06:20:30+00:00

You can see from the logging above that ImageMagick took 25 minutes (8:28 - 8:53). I called Ghostscript directly for the same input by typing this:
Code: Select all
gswin64c.exe -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792 "-sOutputFile=test-%08d.png" "-fspru198j_programmers_guide.pdf"

and the conversion took only 3 minutes by a memory usage peak of 90MB! :shock: This means ImageMagick spends 22 minutes by just throughputting, am I right?

P.S.: The -verbose output of ImageMagick says "gswin32c.exe" but I don't have this file on my computer. So parts of the -verbose message seems to be faked. Furthermore, the second -f parameter is strange since it isn't necessary on conversion.
Last edited by FBR on 2012-03-22T07:23:48+00:00, edited 1 time in total.
User avatar
FBR
 
Posts: 16
Joined: 2012-03-01T01:59:37+00:00

Re: convert(PDF=>PNG) is extremely slow on Windows,fast on L

Postby magick » 2012-03-22T06:55:51+00:00

It seems so. Perhaps its Windows because the same conversion takes less than 3 minutes on my Linux box.
User avatar
magick
Site Admin
 
Posts: 9546
Joined: 2003-05-31T11:32:55+00:00

Re: convert(PDF=>PNG) is extremely slow on Windows,fast on L

Postby FBR » 2012-03-22T07:09:22+00:00

magick wrote:It seems so. Perhaps its Windows because the same conversion takes less than 3 minutes on my Linux box.

File writing to disk cannot be the reason since Ghostscript uses it also if called directly.

The bottleneck may be your data piping to the called process. I don't know what the interface to GS is but I remember techniques of a localhost TCP socket sending, shared memory or data piping via Qt's class QProcess. I don't remember they are slow on Windows.
User avatar
FBR
 
Posts: 16
Joined: 2012-03-01T01:59:37+00:00

Re: convert(PDF=>PNG) is extremely slow on Windows,fast on L

Postby magick » 2012-03-22T09:10:00+00:00

Data is available from disk, so there is no piping in this workflow. ImageMagick the same codeset under both Windows and Linux. ImageMagick saves the entire book on disk after its rendered before it is written as PNG to disk. Perhaps the I/O is slow under Windows. That's a big differential-- under 3 minutes under Linux and over 15 minutes under Windows.
User avatar
magick
Site Admin
 
Posts: 9546
Joined: 2003-05-31T11:32:55+00:00

Re: convert(PDF=>PNG) is extremely slow on Windows,fast on L

Postby FBR » 2012-03-22T12:49:50+00:00

magick wrote:Data is available from disk, so there is no piping in this workflow.

I understand this as if Ghostscript is commanded to load its input from and save its output to disk. Do you call Ghostscript as external process or as thread from a GS library within your program?

magick wrote:ImageMagick saves the entire book on disk after its rendered before it is written as PNG to disk.

This is a logically absolutely confusing sentence. I understood that you just call Ghostscript and command it to convert 1 PDF file to multiple PNG files. But now you write there are 3 steps:
1. rendering (by IM or GS?)
2. ImageMagick saves the entire book on disk (Why IM? I thought GS saves it, doesn't it?)
3. is written (by which IM or GS???) as PNG to disk (saved to disk again? Why twice?)

Perhaps the I/O is slow under Windows.

Saving 3MB never ever takes several minutes on Windows. Even a MS DOS PC 20 years ago saved faster. This is clearly a program issue.
User avatar
FBR
 
Posts: 16
Joined: 2012-03-01T01:59:37+00:00

Re: convert(PDF=>PNG) is extremely slow on Windows,fast on L

Postby magick » 2012-03-22T14:52:12+00:00

The best explanation comes from http://www.imagemagick.org/script/architecture.php. Understanding the architecture explains why ImageMagick takes so long to process the book but not why its so fast on Linux than on Windows.
User avatar
magick
Site Admin
 
Posts: 9546
Joined: 2003-05-31T11:32:55+00:00

Re: convert(PDF=>PNG) is extremely slow on Windows,fast on L

Postby FBR » 2012-03-22T16:29:21+00:00

I can't get it why ImageMagick doesn't just call Ghostscript as external call doing the conversion. But maybe I take a look at your architecture description. I think I'm at a dead end here. Thanks for your replies anyway.
User avatar
FBR
 
Posts: 16
Joined: 2012-03-01T01:59:37+00:00

Re: convert(PDF=>PNG) is extremely slow on Windows,fast on L

Postby dranakan » 2013-08-07T23:11:50+00:00

Hi,

We get also slow process with Windows (XP, Seven, ...). It's more 2x slower than on a Linux.

Code: Select all
convert -density 156 -threshold 51% file.pdf +adjoin file.gif


What can I do to improve speed on Windows ?
dranakan
 
Posts: 9
Joined: 2010-01-10T23:40:16+00:00

Previous

Return to Bugs

Who is online

Users browsing this forum: No registered users and 5 guests