Optimize IM installation for speed?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jorlando

Optimize IM installation for speed?

Post by jorlando »

Hi, I'm running IM on 2 different servers. The hardware of each server is equal. One is running ver. 6.5.2-3 2009-05-09 Q16 OpenMP and the other 6.5.3-2 2009-06-06 Q16 OpenMP

The server with the older version is going away because of a host of IM problems and features that don't work including ssh commandline, -distort, -strokewidth, and a few others.

The system running 6.5.3-2 runs IM perfectly but seems to run slower given the same task which is to generate jpg images via php-exec with the -caption command.

Are there choices that can be made during installation to optimize IM for text/font -caption handling without giving up other features?

Also, does IM offer any benchmarking tools other than the -debug command?

thx
Jeff
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Optimize IM installation for speed?

Post by magick »

Type
  • identify -version
and ensure it mentions OpenMP. Also add -debug cache to your command line to ensure pixels are cached to memory rather than disk. Otherwise we can not think of a reason 6.5.3-2 and 6.5.2-3 would differ in speed.

ImageMagick includes a -bench option, for example:
  • convert -bench 20 logo: -shear 5x2 null:
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Optimize IM installation for speed?

Post by anthony »

If the quality of the final image is not vital (you are not doing multiple and extreme heavy color modifications, or working with photo quality images, that will be enlarged to 'poster' sizes), then using or recompiling IM to be a Q8 version can make it run a lot faster with much less memory per image. The difference however should be reasonably close, so Q8 should do the job.

Best idea is to try it with the most distorted and color modified image proceesing you can find, and compare the results between Q8 and Q16 to see if it was worth it.

Oh and of course, do report what you find, and decided to go with, good or bad.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
jorlando

Re: Optimize IM installation for speed?

Post by jorlando »

I reinstalled with Q-8 but don't see any difference.

The hardware is the same on both servers and they are hosted on the same network node , one IM install (6.5.2) is about 30-40% faster than the other but fails on several different functions described above..

When I run .identify -list configure on the faster install, no delegates show up in the output (see below) yet it reads and writes jpg,png,svg files OK.

I loaded 6.5.3 to a different folder and ran ./configure. No delegates were found. (see below)

So I wonder how IM can read and write jpg, png, svg without any delegates and do so 30% faster? Where is the faster install getting its delegates? I want to duplicate the installation in search of the speed but without the failures. Is there a simple way I can link the delegates for jpg, png, svg, and gif into the compile? (rather than installing them by hand?)

You can compare the 2 installs:
faster: http://interactimage.com
slower: http://fontmail.net

One final note. The faster install was done on my request by the support dept. for the vps server provider. Initially, it wouldn't read and write files and I had to submit a ticket asking them to fix it. They got the files to read and write OK but left with the various other issues and delegate libs hidden someplace. Any ideas on how they may have done it?


Some outputs are shown below...

on the faster install:

Code: Select all

/usr/local/bin$ identify -list configure
Path: /usr/local/lib/ImageMagick-6.5.2/config/configure.xml
Name          Value
-------------------------------------------------------------------------------
CC            gcc -std=gnu99
CFLAGS        -fopenmp -g -O2 -Wall -W -pthread
CONFIGURE     ./configure  '--with-bzlib=yes' '--with-djvu=yes' '--with-fpx=yes' '--with-freetype=yes' '--with-gvc=yes' '--with-jbig=yes' '--with-jpeg=yes' '--with-jp2=yes' '--with-lcms=yes' '--with-perl=yes' '--with-png=yes' '--with-wmf=yes'
COPYRIGHT     Copyright (C) 1999-2009 ImageMagick Studio LLC
CPPFLAGS      -I/usr/local/include/ImageMagick
CXX           g++
CXXFLAGS      -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-fontconfig=no --with-gslib=no --with-fontpath= --with-rsvg=no --with-xml=no
EXEC-PREFIX   /usr/local
HOST          i686-pc-linux-gnu
LDFLAGS       -L/usr/local/lib 
LIB_VERSION   0x652
LIB_VERSION_NUMBER 6,5,2,3
LIBS          -lMagickCore -lm -lgomp -lpthread 
NAME          ImageMagick
PCFLAGS       -fopenmp
PREFIX        /usr/local
QuantumDepth  16
RELEASE_DATE  2009-05-09
VERSION       6.5.2
WEBSITE       http://www.imagemagick.org
on the slower install the delegates appear:

Code: Select all

/usr/local/lib$ identify -list configure
Path: /usr/local/lib/ImageMagick-6.5.2/config/configure.xml
Name          Value
-------------------------------------------------------------------------------
CC            gcc -std=gnu99
CFLAGS        -fopenmp -g -O2 -Wall -W -pthread
CONFIGURE     ./configure  '--with-quantum-depth=8' '--without-magick-plus-plus'
COPYRIGHT     Copyright (C) 1999-2009 ImageMagick Studio LLC
CPPFLAGS      -I/usr/local/include/ImageMagick
CXX           g++
CXXFLAGS      -g -O2 -Wall -W -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     freetype jpeg jng png wmf zlib
DISTCHECK_CONFIG_FLAGS --disable-deprecated --with-umem=no --with-autotrace=no --with-fontconfig=no --with-gslib=no --with-fontpath= --with-rsvg=no --with-xml=no
EXEC-PREFIX   /usr/local
HOST          i686-pc-linux-gnu
LDFLAGS       -L/usr/local/lib -lfreetype -lz
LIB_VERSION   0x652
LIB_VERSION_NUMBER 6,5,2,3
LIBS          -lMagickCore -lfreetype -ljpeg -lz -lm -lgomp -lpthread 
NAME          ImageMagick
PCFLAGS       -fopenmp
PREFIX        /usr/local
QuantumDepth  8
RELEASE_DATE  2009-06-20
VERSION       6.5.2
WEBSITE       http://www.imagemagick.org
Next I uploaded the latest version of IM to a different folder on the same server and run./configure --with-quantum-depth=8 --prefix=/usr/fig/ which yields a configuration as follows (no delegates) :

Code: Select all

                  Option                        Value
-------------------------------------------------------------------------------
Shared libraries  --enable-shared=yes		yes
Static libraries  --enable-static=yes		yes
Module support    --with-modules=yes		yes
GNU ld            --with-gnu-ld=yes		yes
Quantum depth     --with-quantum-depth=8	8
High Dynamic Range Imagery
                  --enable-hdri=no		no
Delegate Configuration:
BZLIB             --with-bzlib=yes		no
Autotrace         --with-autotrace=no		no
DJVU              --with-djvu=yes		no
DPS               --with-dps=yes		no
FlashPIX          --with-fpx=yes		no
FontConfig        --with-fontconfig=no		no
FreeType          --with-freetype=yes		no
GhostPCL          None				pcl6 (unknown)
GhostXPS          None				gxps (unknown)
Ghostscript       None				gs (8.15.2)
Ghostscript fonts --with-gs-font-dir=default	/usr/share/fonts/default/Type1/
Ghostscript lib   --with-gslib=no		no
Graphviz          --with-gvc=yes		no
JBIG              --with-jbig=yes		no
JPEG v1           --with-jpeg=yes		no
JPEG-2000         --with-jp2=yes		no
LCMS              --with-lcms=yes		no
LQR               --with-lqr=yes		no
Magick++          --with-magick-plus-plus=yes	no (failed tests)
OpenEXR           --with-openexr=yes		no
PERL              --with-perl=yes		/usr/bin/perl
PNG               --with-png=yes		no
RSVG              --with-rsvg=no		no
TIFF              --with-tiff=yes		no
Windows fonts     --with-windows-font-dir=	none
WMF               --with-wmf=yes		no
X11               --with-x=			no
XML               --with-xml=no		no
ZLIB              --with-zlib=yes		no
X11 Configuration:
      X_CFLAGS        = 
      X_PRE_LIBS      = 
      X_LIBS          = 
      X_EXTRA_LIBS    = 
Options used to compile and link:
  PREFIX          = /usr/fig
  EXEC-PREFIX     = /usr/fig
  VERSION         = 6.5.3
  CC              = gcc -std=gnu99
  CFLAGS          = -fopenmp -g -O2 -Wall -W -pthread
  MAGICK_CFLAGS   = -fopenmp -g -O2 -Wall -W -pthread
  CPPFLAGS        = -I/usr/fig/include/ImageMagick
  PCFLAGS         = -fopenmp
  DEFS            = -DHAVE_CONFIG_H
  LDFLAGS         = 
  MAGICK_LDFLAGS  = -L/usr/fig/lib 
  LIBS            = -lMagickCore -lm -lgomp -lpthread 
  CXX             = g++
  CXXFLAGS        = -pthread
jorlando

Re: Optimize IM installation for speed?

Post by jorlando »

I found that an YUM install of 6.2.8 (latest available) runs much faster, on the -caption command at least, than an installation I did from source.

outputs from convert -list configure are shown below.

There are a lot of libs shown on the YUM install that don't appear on the one installed from source. Would one of these libs account for the extra speed of 6.2.8?

Is there a way to take advantage of all the libs added by YUM in the compile done from source? I tried adding LDFLAGS=-L/usr/lib during configure but it didn't seem to make a difference

Thanks
Jeff


Yum Install:

Code: Select all

/root$ /usr/bin/convert -list configure
Path: /usr/lib/ImageMagick-6.2.8/config/configure.xml
Name          Value
-------------------------------------------------------------------------------
CC            gcc
CFLAGS        -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall -pthread
CONFIGURE     ./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --with-modules --with-perl --with-x --with-threads --with-magick_plus_plus --with-gslib --with-wmf --with-lcms --with-rsvg --with-xml --with-perl-options=INSTALLDIRS=vendor CC='gcc -L/builddir/build/BUILD/ImageMagick-6.2.8/magick/.libs' LDDLFLAGS='-shared -L/builddir/build/BUILD/ImageMagick-6.2.8/magick/.libs' --with-windows-font-dir=/usr/share/fonts/default/TrueType --without-dps
COPYRIGHT     Copyright (C) 1999-2005 ImageMagick Studio LLC
CPPFLAGS      -I/usr/include
CXX           g++
CXXFLAGS      -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -pthread
DEFS          -DHAVE_CONFIG_H
DISTCHECK_CONFIG_FLAGS 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'  --with-quantum-depth=16  --with-dps=no  --with-fpx=no  --with-fontpath=  --with-windows-font-dir==/usr/share/fonts/default/TrueType 
EXEC-PREFIX   /usr
HOST          i686-redhat-linux-gnu
LDFLAGS       -L/usr/lib -lfreetype -L/usr/lib
LIB_VERSION   0x628
LIB_VERSION_NUMBER 6,2,8,0
LIBS          -lMagick -llcms -ltiff -lfreetype -ljpeg -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lpthread -lm -lpthread
NAME          ImageMagick
PCFLAGS       
PREFIX        /usr
QuantumDepth  16
RELEASE_DATE  04/17/08
VERSION       6.2.8
WEBSITE       http://www.imagemagick.org
source install:

Code: Select all

/root$ convert -list configure
Path: /usr/local/lib/ImageMagick-6.5.3/config/configure.xml
Name          Value
-------------------------------------------------------------------------------
CC            gcc -std=gnu99
CFLAGS        -fopenmp -g -O2 -Wall -W -pthread
CONFIGURE     ./configure  'LDFLAGS=-L/usr/local/lib/' '--with-xml=yes' '--with-freetype=yes' '--with-fontconfig=yes' '--with-zlib=yes' '--with-lcms=yes'
COPYRIGHT     Copyright (C) 1999-2009 ImageMagick Studio LLC
CPPFLAGS      -I/usr/local/include/ImageMagick
CXX           g++
CXXFLAGS      -g -O2 -Wall -W -pthread
DEFS          -DHAVE_CONFIG_H
DELEGATES     fontconfig freetype jpeg jng png xml wmf zlib
DISTCHECK_CONFIG_FLAGS 'LDFLAGS=-L/usr/local/lib/' --disable-deprecated --with-quantum-depth=16 --with-umem=no --with-autotrace=no --with-gslib=no --with-fontpath= --with-rsvg=no
EXEC-PREFIX   /usr/local
HOST          i686-pc-linux-gnu
LDFLAGS       -L/usr/local/lib -L/usr/local/lib/ -lfreetype -lz -L/usr/local/lib
LIB_VERSION   0x653
LIB_VERSION_NUMBER 6,5,3,10
LIBS          -lMagickCore -lfreetype -ljpeg -L/usr/local/lib -lfontconfig -lz -lm -lgomp -lpthread
NAME          ImageMagick
PCFLAGS       -fopenmp
PREFIX        /usr/local
QuantumDepth  16
RELEASE_DATE  2009-06-24
VERSION       6.5.3
WEBSITE       http://www.imagemagick.org
Post Reply