[llvm-commits] CVS: llvm/lib/Support/Compressor.cpp

Reid Spencer reid at x10sys.com
Tue Nov 9 09:58:19 PST 2004



Changes in directory llvm/lib/Support:

Compressor.cpp updated: 1.4 -> 1.5
---
Log message:

Tune compression:
bzip2: block size 9 -> 5, reduces memory by 400Kbytes, doesn't affect speed
       or compression ratio on all but the largest bytecode files (>1MB)
zip:   level 9 -> 6, this speeds up compression time by ~30% but only 
       degrades the compressed size by a few bytes per megabyte. Those few
       bytes aren't worth the effort.


---
Diffs of the changes:  (+2 -2)

Index: llvm/lib/Support/Compressor.cpp
diff -u llvm/lib/Support/Compressor.cpp:1.4 llvm/lib/Support/Compressor.cpp:1.5
--- llvm/lib/Support/Compressor.cpp:1.4	Mon Oct  4 12:45:44 2004
+++ llvm/lib/Support/Compressor.cpp	Tue Nov  9 11:58:09 2004
@@ -136,7 +136,7 @@
       bzdata.avail_in = size;
       bzdata.next_out = 0;
       bzdata.avail_out = 0;
-      switch ( BZ2_bzCompressInit(&bzdata, 9, 0, 100) ) {
+      switch ( BZ2_bzCompressInit(&bzdata, 5, 0, 100) ) {
         case BZ_CONFIG_ERROR: throw std::string("bzip2 library mis-compiled");
         case BZ_PARAM_ERROR:  throw std::string("Compressor internal error");
         case BZ_MEM_ERROR:    throw std::string("Out of memory");
@@ -190,7 +190,7 @@
       zdata.opaque = Z_NULL;
       zdata.next_in = reinterpret_cast<Bytef*>(in);
       zdata.avail_in = size;
-      if (Z_OK != deflateInit(&zdata,Z_BEST_COMPRESSION))
+      if (Z_OK != deflateInit(&zdata,6))
         throw std::string(zdata.msg ? zdata.msg : "zlib error");
 
       if (0 != getdata((char*&)(zdata.next_out), zdata.avail_out,cb,context)) {






More information about the llvm-commits mailing list