Page 1 of 1

Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-06T10:31:02-07:00
by axelrose
Hello all,

I got used to this little benchmark

Code: Select all

convert logo: -resize 1000% -bench 5 /tmp/logo.png
When using

Code: Select all

Version: ImageMagick 6.6.1-10 2011-01-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP OpenCL 
I get this result:

Code: Select all

Performance: 5i 0.118568ips 37.030u 0:42.170
After upgrading and using

Code: Select all

Version: ImageMagick 6.6.6-10 2011-01-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP OpenCL
it runs much slower

Code: Select all

Performance: 5i 0.00441158ips 991.000u 18.889666664602039248:53.380
The reported time is a bit unreadable. It takes more than 8 minutes ...
All versions were compiled by myself under MacOS X 10.6.5 with identical libraries.

Perhaps there is still something strange with the PNG enocder (??)
Regards, Axel.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-06T11:18:31-07:00
by fmw42
the PNG encoder is being worked on extensively for quite a few releases now. see the changelog at http://www.imagemagick.org/script/changelog.php. Try the latest version 6.6.6.10 or the beta of 6.6.7.0

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-07T00:16:24-07:00
by anthony
In the mean time try forceing the coder using png32: or png24: for the image output
EG:

Code: Select all

   convert .....  png32:image.png

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-07T01:44:31-07:00
by axelrose
Using png24 or png32 doesn't help. It is still awfully slow:

Code: Select all

> ImageMagick-6.6.6-10/bin/convert logo: -resize 1000% -bench 5 tif:/tmp/logo.png
Performance: 5i 0.427716ips 16.320u 0.19483333428867430359:11.690
> ImageMagick-6.6.6-10/bin/convert logo: -resize 1000% -bench 5 png24:/tmp/logo.png
Performance: 5i 0.00508182ips 959.850u 16.398333330950816134:23.900
That's 11 seconds for TIFF and 34 minutes for PNG24.
(note that the number formatting of -bench is not ideal)
Regards, Axel.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-07T10:53:32-07:00
by fmw42
you could replace -resize with -scale for faster results, but he quality will not be as good when enlarging.

I hope this is a typo in your command

tif:/tmp/logo.png

you will get a tif image with a png suffix -- not a good idea

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-09T08:29:44-07:00
by axelrose
I hope this is a typo in your command
No. I didn't care about the actual file or the actual operation.
My point is that generating large PNGs is awfully slow compared to other image formats.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-09T13:33:53-07:00
by fmw42
try again now in IM 6.6.7.0 and see if any improvement. there has been a lot of changes to improve PNG features, but I don't know what the timing expense is for that.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-10T02:13:38-07:00
by axelrose
I used 6.6.7 from svn.
It still takes ages to create a large PNG with my benchmark.

Regards, Axel.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-10T16:03:05-07:00
by anthony
Presumably the new PNG coder is doing something that takes a lot of time.

Have you tried specifying the specific internal PNG format using either
png32:filaename.png

or using the new PNG coder -define settings.
Look at the header of the coder/png.c source file for the latest defines.

I think the developer is currently working more on getting it 'right' rather than getting is 'fast'.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-10T23:38:13-07:00
by axelrose
time ImageMagick-6.6.7/bin/convert logo: -resize 1000% png32:/tmp/logo.png

needs more than 3 minutes

time ImageMagick-6.6.1-10/bin/convert logo: -resize 1000% png32:/tmp/logo.png

runs in less than 10 seconds (same results for "png24" or "png")

both IM versions are linked against libpng 1.4.4

otool -L ImageMagick-6.6.1-10/bin/convert | grep png
ImageMagick-6.6.1-10/lib/libpng14.14.dylib (compatibility version 19.0.0, current version 19.0.0)
otool -L ImageMagick-6.6.7/bin/convert | grep png
ImageMagick-6.6.7/lib/libpng14.14.dylib (compatibility version 19.0.0, current version 19.0.0)

6.6.7 is from svn

I looked into "coders/png.c" but couldn't spot the mentioned #ifdef.
What define would make a difference?

Thanks, Axel.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-11T18:00:11-07:00
by anthony
I took a look.
Previously there were comments on command line option -define settings tha could be used to control PNG coder. these seem to have disappeared.


NOTE I was referring to documentation in the source NOT compile time #ifdef's

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-25T00:41:14-07:00
by axelrose
Just as a reminder and another viewpoint

convert logo: -resize 1000% tmp.tif

takes 2 seconds

convert logo: -resize 1000% tmp.png

takes 2 minutes with 6.6.7-2 on my machine.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-25T10:19:53-07:00
by glennrp
Working on this. Anthony, the comments are around line 9210.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-25T10:51:12-07:00
by glennrp
The culprit seems to be the call to GetNumberColors(() in the BUILD_PALETTE section.
Testing now to see if I can safely remove the call.

Re: Performance drop after upgrade from 6.6.1 to 6.6.6

Posted: 2011-01-27T01:46:15-07:00
by axelrose
Wonderful.

Thanks for correcting this. PNG conversion are back to normal speed in my tests.


Thanks, Axel.