<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Experts,&nbsp;<div><br><div>I apologize in advance for a long email ... I'm just trying to be thorough. The bottom line is my own build of Cairo compared with the macports/yum build is MUCH too slow, and I don't know why.&nbsp;</div><div><br></div><div>I&nbsp;am working toward getting Cairo to handle all the graphics for GrADS, an open-source program for the analysis and display of meteorological data. The old way of doing graphics in GrADS was a combination of direct calls to the X11 library (for the X window interface), calls to the gd library (for image output), plus some extremely dated code to create postscript output. All text was drawn in Hershey fonts. Cairo improves on this mish-mash in so many ways; the graphics are looking absolutely fantastic, the toy font API is adequate for our needs, and I know my users are going to be very excited when they see these improvements.&nbsp;<div><br></div><div>For GrADS distribution, I provide binary executables for a small set of platforms, but many users must build from source. GrADS requires a long list of supplemental libraries to fully enable all its features: the current count is 20. With the exception of X11 and a few other system libs, we link statically with all these supplibs, so that our binaries are portable (some of the supplibs GrADS needs are rather obscure.) I get the impression from browsing through the forum archives that linking statically with Cairo isn't really the right way to do it, so&nbsp;during my development and testing&nbsp;I have been linking dynamically with a macports build of Cairo. It's been fine that way, a little slower than the old way of using direct X11 calls, but not deal-breakingly slow.&nbsp;</div><div><br></div><div>Looking forward to the time when I must put out a release, I am trying to integrate Cairo into the GrADS autoconfiguration scripts and the setup we have for building all the supplibs from source.&nbsp;I can't assume that all my users will have macports or yum to do the dirty work for them, so I provide a set of instructions to build the libraries from source and link them with GrADS. It is something like the end-to-end build instructions on the Cairo website. I try to keep it as simple as possible, and tailor these instructions for the specific needs of GrADS.&nbsp;</div><div><br></div><div>Testing out my home-grown Cairo recipe,&nbsp;it built without any problems (specifics given below). Then&nbsp;I linked GrADS two ways, one with the macports build (gfast), the other with my home-grown build (gslow). More specifics on how I linked the executables and output from otool are given below.&nbsp;The performance difference between glsow v. gfast is astonishing. Where gfast took 1-2 seconds to draw a plot, gslow took ~100 seconds to do the same thing. I reran all these steps on our 64-bit linux server running CentOS 5.4 and got similar results.&nbsp;</div><div><br></div><div>Thanks to earlier answers I got regarding getting cairo-trace to work, I created a huge trace file, but I'm not sure how to interpret it. It contained ~77,000 fills and ~10,000 strokes. I reran cairo-trace with the --profile option and posted it at <a href="ftp://iges.org/pub/jma/gs.89039.lzma">ftp://iges.org/pub/jma/gs.89039.lzma</a> . The output from running cairo-perf-trace on my trace file is given below.&nbsp;I have no idea whether the trace info is helpful.&nbsp;</div><div><br></div><div>What I could use is some advice about linking statically v. dynamically for my binary distributions, and some guidance for how to build Cairo from source (with only as-needed features) and link it with my application so that I get the same performance as the carefully packaged, fully-enabled versions of Cairo.&nbsp;</div><div><br></div><div>Thank you!!&nbsp;</div><div>--Jennifer</div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><br></div><div><br></div><div><div apple-content-edited="true"> <div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 12px; "><div>--</div><div>Jennifer M. Adams</div><div>IGES/COLA</div><div>4041 Powder Mill Road, Suite 302</div><div>Calverton, MD 20705</div><div><a href="mailto:jma@cola.iges.org">jma@cola.iges.org</a></div><div><br class="khtml-block-placeholder"></div><div><br></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" face="Helvetica"><br></font></font></div></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">OS X version 10.5.8</span></font></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 12px; "><br></div> </div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">&gt; uname -a</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">Darwin Atlantic-2.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386</span></font></div></div></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">&gt; gcc --version</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><span class="Apple-style-span" style="font-family: Courier; font-size: 12px; "><br></span></div><div><span class="Apple-style-span" style="font-family: Courier; font-size: 12px; ">Configuration options used to build cairo from source:</span></div></div><div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">pkg-config-0.23</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">(I then set the environment vars PKG_CONFIG and&nbsp;PKG_CONFIG_PATH to the appropriate places)</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">pixman-0.21.2&nbsp;</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">freetype-2.4.3&nbsp;&nbsp;--without-fsspec --without-fsref --without-ats&nbsp;--without-quickdraw-toolbox --without-quickdraw-carbon&nbsp;</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">fontconfig-2.8.0 &nbsp;--enable-libxml2&nbsp;--with-freetype-config=...</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">cairo-1.10.2&nbsp;</span></font><span class="Apple-style-span" style="font-family: Courier; font-size: 12px; ">--disable-dependency-tracking \</span></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-xlib=yes \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-xml=yes \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-fc=yes \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-ft=yes \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-xlib-xrender=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-xcb=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-qt=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-quartz=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-win32=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-skia=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-os2=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-beos=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-drm=no \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-pthread \</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;">--enable-gl=no</span></font></div></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px;"><br></span></font></div><div><br></div><div><div style="font-family: Courier; font-size: 12px; ">Linking commands used to build gfast and gslow (relevant bits highlighed in red):&nbsp;</div><div style="font-family: Courier; font-size: 12px; "><br></div><div style="font-family: Courier; font-size: 12px; "><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; "><div>gcc &nbsp;-g -O2 &nbsp;-lSystemStubs&nbsp;<font class="Apple-style-span" color="#FF0013">-o gslow</font>&nbsp;grads.o gxsubs.o gxmeta.o gxchpl.o gxcntr.o gxstrm.o gxwmap.o gxshad.o gxshad2.o gaexpr.o gafunc.o gautil.o gagx.o gscrpt.o gamach.o bufrstn.o gabufr.o gabufrtbl.o gxX.o gxdxwd.o galloc.o gaddes.o gaio.o gacfg.o gauser.o gasdf.o gatxt.o&nbsp;<font class="Apple-style-span" color="#FF0013">-L/Users/jma/supplibs/lib -lcairo -L/usr/X11R6/lib -lX11&nbsp;</font>/Users/jma/supplibs/lib/libreadline.a /Users/jma/supplibs/lib/libncurses.a &nbsp;/Users/jma/supplibs/lib/libgd.a /Users/jma/supplibs/lib/libpng12.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libjpeg.a /Users/jma/supplibs/lib/libgrib2c.a /Users/jma/supplibs/lib/libjasper.a /Users/jma/supplibs/lib/libpng12.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libmfhdf.a /Users/jma/supplibs/lib/libdf.a /Users/jma/supplibs/lib/libudunits.a /Users/jma/supplibs/lib/libsz.a /Users/jma/supplibs/lib/libjpeg.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libhdf5.a /Users/jma/supplibs/lib/libsz.a /Users/jma/supplibs/lib/libjpeg.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libudunits.a /Users/jma/supplibs/lib/libnetcdf.a /Users/jma/supplibs/lib/libhdf5_hl.a /Users/jma/supplibs/lib/libhdf5.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libsz.a /Users/jma/supplibs/lib/libcurl.a &nbsp;/Users/jma/supplibs/lib/libtiff.a /Users/jma/supplibs/lib/libgeotiff.a /Users/jma/supplibs/lib/libshp.a &nbsp;-lm&nbsp;</div><div><br></div><div>gcc &nbsp;-g -O2 &nbsp;-lSystemStubs&nbsp;<font class="Apple-style-span" color="#FF0013">-o gfast</font>&nbsp;grads.o gxsubs.o gxmeta.o gxchpl.o gxcntr.o gxstrm.o gxwmap.o gxshad.o gxshad2.o gaexpr.o gafunc.o gautil.o gagx.o gscrpt.o gamach.o bufrstn.o gabufr.o gabufrtbl.o gxX.o gxdxwd.o galloc.o gaddes.o gaio.o gacfg.o gauser.o gasdf.o gatxt.o&nbsp;<font class="Apple-style-span" color="#FF0013">-L/opt/local/lib -lcairo -lX11&nbsp;</font>/Users/jma/supplibs/lib/libreadline.a /Users/jma/supplibs/lib/libncurses.a &nbsp;/Users/jma/supplibs/lib/libgd.a /Users/jma/supplibs/lib/libpng12.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libjpeg.a /Users/jma/supplibs/lib/libgrib2c.a /Users/jma/supplibs/lib/libjasper.a /Users/jma/supplibs/lib/libpng12.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libmfhdf.a /Users/jma/supplibs/lib/libdf.a /Users/jma/supplibs/lib/libudunits.a /Users/jma/supplibs/lib/libsz.a /Users/jma/supplibs/lib/libjpeg.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libhdf5.a /Users/jma/supplibs/lib/libsz.a /Users/jma/supplibs/lib/libjpeg.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libudunits.a /Users/jma/supplibs/lib/libnetcdf.a /Users/jma/supplibs/lib/libhdf5_hl.a /Users/jma/supplibs/lib/libhdf5.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libsz.a /Users/jma/supplibs/lib/libcurl.a &nbsp;/Users/jma/supplibs/lib/libtiff.a /Users/jma/supplibs/lib/libgeotiff.a /Users/jma/supplibs/lib/libshp.a &nbsp;-lm&nbsp;</div><div><br></div><div><br></div><div><div>&gt; otool -L gslow</div><div>gslow:</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/Users/jma/supplibs/src/cairo/lib/libcairo.2.dylib (compatibility version 11003.0.0, current version 11003.2.0)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/usr/X11/lib/libX11.6.dylib (compatibility version 9.0.0, current version 9.0.0)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.5)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)</div><div>&gt; otool -L gfast</div><div>gfast:</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/opt/local/lib/libcairo.2.dylib (compatibility version 11003.0.0, current version 11003.0.0)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/opt/local/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.5)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)</div></div><div><br></div><div><br></div><div><div style="font-family: Helvetica; font-size: medium; "><span class="Apple-style-span" style="font-family: Courier; font-size: 12px; ">&gt; cairo-perf-trace gg.88743.trace</span></div><div style="font-family: Helvetica; font-size: medium; "><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">[ # ] &nbsp;backend &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; test &nbsp; min(s) median(s) stddev. count</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">[ # ] &nbsp; &nbsp;image: pixman 0.21.2</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">[ &nbsp;0] &nbsp; &nbsp;image &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gg &nbsp; &nbsp;0.691 &nbsp; &nbsp;0.696 &nbsp; 0.30% &nbsp; &nbsp;6/6</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">[ # ] &nbsp;image16: pixman 0.21.2</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">[ &nbsp;0] &nbsp;image16 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gg &nbsp; &nbsp;0.692 &nbsp; &nbsp;0.696 &nbsp; 0.21% &nbsp; &nbsp;6/6</span></font></div></div><div style="font-family: Helvetica; font-size: medium; "><br></div><div style="font-family: Helvetica; font-size: medium; "><br></div></div></span></font></div></div></div></body></html>