Gzip

Recommended Flags

Fastest possible gzip performance can be attained with these Sun Studio Compiler flags:

-fast -g -xtarget=generic -xipo=2 -xprofile=[collect|use] -zlazyload
  • Because code paths through gzip are remarkably consistent for most types of input files, using profile feedback results in speedups for almost all applications of gzip with a small training workload. Additionally, gzip compiles very quickly making it relatively painless to build a binary with -xprofile. A single script that builds and trains a highly optimized version of gzip is available for download in this document's Scripts section.
  • If it is expected that PHP will only be run on a similar system to the one that it's compiled on then -xtarget=generic should be removed from the flags string. This can result in performance gains of roughly 5% on UltraSPARC IV+ systems.
  • The linker option -zlazyload delays the loading of shared objects until they are actually needed. There is a speedup of a few percent on applications that repeatedly call gzip on small files.

Performance vs. Tuning and Compiler Flags

Flags UltraSPARC IV+ Performance UltraSPARC T1 Performance
SunFreeware.com (GCC compiled at -O2) 32% 36%
/bin/gzip (Solaris, O4) 100% 100%
-fast 105% 103%
-fast -xprofile=<collect,use> 114% 111%
-fast -xipo -xprofile=<collect,use> 125% 122%

The benchmark used to generate the data in the table above was developed internally to Sun. It compresses and decompresses several different types of files (PDF, image, html, source code, random data and executable) ranging in size from 1 MB to 10 MB.

Configure Invocation

export CC=cc
export CXX=CC
export CFLAGS="-g -fast"

./configure

Build Notes

Building a binary with -xprofile is fast and straightforward. If you do not want to use the automated script below the build can be easily done by hand in the following steps:

  1. Edit Makefile and set the CFLAGS string to -fast -g -xtarget=generic -xipo=2 -xprofile=collect:/tmp/gzip
  2. gmake clean;gmake -j8 install;rm -r /tmp/gzip.profile
  3. <run training workload>
  4. Edit Makefile and set the CFLAGS string to -fast -g -xtarget=generic -xipo=2 -xprofile=use:/tmp/gzip
  5. gmake clean;gmake -j8 install;

Known Compile Issues

None.

Scripts

A script that will automatically build gzip at the highest level of optimization is included in the file gzip_files.tar.gz. Steps:

  1. Download gzip_files.tar.gz to the gzip source directory where "Makefile" resides
  2. gunzip gzip_files.tar.gz
  3. tar -xvf gzip_files.tar
  4. ./build_train.pl
  5. Gzip is not installed at this point. If you wish, type gmake install.

Legal/copyright note: the image file used for training was obtained under Creative Commons Attribution 2.5 License.

Source Code

The latest source code can be downloaded from gnu.org.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact