<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Experts, <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. </div><div><br></div><div>I 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. <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 during my development and testing 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. </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. 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. </div><div><br></div><div>Testing out my home-grown Cairo recipe, it built without any problems (specifics given below). Then 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. 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. </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. I have no idea whether the trace info is helpful. </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. </div><div><br></div><div>Thank you!! </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;">> 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;">> 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 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 </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 --without-fsspec --without-fsref --without-ats --without-quickdraw-toolbox --without-quickdraw-carbon </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 --enable-libxml2 --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 </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): </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 -g -O2 -lSystemStubs <font class="Apple-style-span" color="#FF0013">-o gslow</font> 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 <font class="Apple-style-span" color="#FF0013">-L/Users/jma/supplibs/lib -lcairo -L/usr/X11R6/lib -lX11 </font>/Users/jma/supplibs/lib/libreadline.a /Users/jma/supplibs/lib/libncurses.a /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 /Users/jma/supplibs/lib/libtiff.a /Users/jma/supplibs/lib/libgeotiff.a /Users/jma/supplibs/lib/libshp.a -lm </div><div><br></div><div>gcc -g -O2 -lSystemStubs <font class="Apple-style-span" color="#FF0013">-o gfast</font> 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 <font class="Apple-style-span" color="#FF0013">-L/opt/local/lib -lcairo -lX11 </font>/Users/jma/supplibs/lib/libreadline.a /Users/jma/supplibs/lib/libncurses.a /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 /Users/jma/supplibs/lib/libtiff.a /Users/jma/supplibs/lib/libgeotiff.a /Users/jma/supplibs/lib/libshp.a -lm </div><div><br></div><div><br></div><div><div>> otool -L gslow</div><div>gslow:</div><div> /Users/jma/supplibs/src/cairo/lib/libcairo.2.dylib (compatibility version 11003.0.0, current version 11003.2.0)</div><div> /usr/X11/lib/libX11.6.dylib (compatibility version 9.0.0, current version 9.0.0)</div><div> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.5)</div><div> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)</div><div>> otool -L gfast</div><div>gfast:</div><div> /opt/local/lib/libcairo.2.dylib (compatibility version 11003.0.0, current version 11003.0.0)</div><div> /opt/local/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)</div><div> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.5)</div><div> /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; ">> 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; ">[ # ] backend test 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; ">[ # ] 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; ">[ 0] image gg 0.691 0.696 0.30% 6/6</span></font></div><div><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; ">[ # ] 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; ">[ 0] image16 gg 0.692 0.696 0.21% 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>