Ubuntu 12.04’s ghostscript v. 9 is 10–20 times slower than v. 8

Wojciech Ziniewicz
Stories imported from wordpress
2 min readOct 8, 2013

Recently I’ve migrated huge rails app to Amazon Opsworks which support Amazon Linux and Ubuntu. My customers started to whine about the time that it takes to process their pdfs. I did some research and it came out that ghostscript version 9.05 that is the only available version on apt-get.

I was using this PDF for benchmarks .

This is benchmark for ghostscript 8.71 installed on Debian Squeeze. It takes 0.165s to process the file.

[code language=”shell”]
root@app2:/tmp# time gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dAlignToPixels=0 -dGridFitTT=2 “-sDEVICE=pbmraw” -dTextAlphaBits=4 -dGraphicsAlphaBits=4 “-r72x72” -dUseCIEColor -dFirstPage=1 -dLastPage=1 “-sOutputFile=/tmp/magick-gY9GM5s6-%08d” -dNumRenderingThreads=8 -f ABC_Birgitte.pdf

real 0m0.165s
user 0m0.144s
sys 0m0.020s
[/code]

Below we see it’s opponent — ghostscript 9.05 installed on Ubuntu 12.04: 10.3 s

[code language=”shell”]
root@chili-pepper:/home/ubuntu# time gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dAlignToPixels=0 -dGridFitTT=2 “-sDEVICE=pbmraw” -dTextAlphaBits=4 -dGraphicsAlphaBits=4 “-r72x72” -dUseCIEColor -dFirstPage=1 -dLastPage=1 “-sOutputFile=/tmp/magick-gY9GM5s6-%08d” -dNumRenderingThreads=8 -dNOGC -dBandBufferSpace=500000000 -dBufferSpace=1000000000 -f ABC_Birgitte.pdf

real 0m10.334s
user 0m10.249s
sys 0m0.088s
[/code]

Last but not least — ghostscript 9.05 installed on Ubuntu 12.04 from sources. 50% faster than identical version patched by Ubuntu developers: 5.3s

[code language=”shell”]
root@chili-pepper:/home/ubuntu# time gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dAlignToPixels=0 -dGridFitTT=2 “-sDEVICE=pbmraw” -dTextAlphaBits=4 -dGraphicsAlphaBits=4 “-r72x72” -dUseCIEColor -dFirstPage=1 -dLastPage=1 “-sOutputFile=/tmp/magick-gY9GM5s6-%08d” -dNumRenderingThreads=8 -dNOGC -dBandBufferSpace=500000000 -dBufferSpace=1000000000 -f ABC_Birgitte.pdf

real 0m5.324s
user 0m5.141s
sys 0m0.088s
[/code]

And the winner is “gs-910-linux_x86_64” version 9.07 which is a ghostscript vanilla binary downloaded from the site 1.2s (which is still almost 10 times slower than in ghostscript 8.71 though)

[code language=”shell”]
root@chili-pepper:/home/ubuntu# time gs -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dAlignToPixels=0 -dGridFitTT=2 “-sDEVICE=pbmraw” -dTextAlphaBits=4 -dGraphicsAlphaBits=4 “-r72x72” -dUseCIEColor -dFirstPage=1 -dLastPage=1 “-sOutputFile=/tmp/magick-gY9GM5s6-%08d” -dNumRenderingThreads=8 -dNOGC -dBandBufferSpace=500000000 -dBufferSpace=1000000000 -f ABC_Birgitte.pdf

real 0m1.234s
user 0m1.121s
sys 0m0.248s
[/code]

Conclusion: Ubuntu 12.04 ghostscript in version 9.05 has very very very poor performance.

--

--