aboutsummaryrefslogtreecommitdiff
path: root/archival/bzip2.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-10-14 00:43:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-10-14 00:43:01 +0000
commitef3aabe906a351f0bdf97199b4f38a2c6b54eaa5 (patch)
tree7ce8c73be864396eb656c2ef59ef797824a07942 /archival/bzip2.c
parent77f1ec1b9bf100e6c10aa0856c7156e321511785 (diff)
downloadbusybox-ef3aabe906a351f0bdf97199b4f38a2c6b54eaa5.tar.gz
bzip2: size reduction, to just below 9k.
Diffstat (limited to 'archival/bzip2.c')
-rw-r--r--archival/bzip2.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/archival/bzip2.c b/archival/bzip2.c
index 04478eecc..bb1610eb4 100644
--- a/archival/bzip2.c
+++ b/archival/bzip2.c
@@ -9,8 +9,28 @@
#include "libbb.h"
-/* This buys 6% speed for nearly 4k code */
-/*#define FAST_GROUP6 1*/
+#define CONFIG_BZIP2_FEATURE_SPEED 1
+
+/* Speed test:
+ * Compiled with gcc 4.2.1, run on Athlon 64 1800 MHz (512K L2 cache).
+ * Stock bzip2 is 26.4% slower than bbox bzip2 at SPEED 1
+ * (time to compress gcc-4.2.1.tar is 126.4% compared to bbox).
+ * At SPEED 5 difference is 32.7%.
+ *
+ * Test run of all CONFIG_BZIP2_FEATURE_SPEED values on a 11Mb text file:
+ * Size Time (3 runs)
+ * 0: 10828 4.145 4.146 4.148
+ * 1: 11097 3.845 3.860 3.861
+ * 2: 11392 3.763 3.767 3.768
+ * 3: 11892 3.722 3.724 3.727
+ * 4: 12740 3.637 3.640 3.644
+ * 5: 17273 3.497 3.509 3.509
+ */
+
+
+#define BZ_DEBUG 0
+/* Takes ~300 bytes, detects corruption caused by bad RAM etc */
+#define BZ_LIGHT_DEBUG 0
#include "bz/bzlib.h"
@@ -19,9 +39,7 @@
#include "bz/blocksort.c"
#include "bz/bzlib.c"
#include "bz/compress.c"
-#include "bz/crctable.c"
#include "bz/huffman.c"
-#include "bz/randtable.c"
/* No point in being shy and having very small buffer here.
* bzip2 internal buffers are much bigger anyway, hundreds of kbytes.
@@ -36,7 +54,7 @@ enum {
/* Returns:
* <0 on write errors (examine errno),
* >0 on short writes (errno == 0)
- * 0 no error (entire input consume, gimme more)
+ * 0 no error (entire input consumed, gimme more)
* on "impossible" errors (internal bzip2 compressor bug) dies
*/
static
@@ -44,8 +62,6 @@ ssize_t bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, void *wbuf)
{
int n, n2, ret;
- /* if (len == 0) return 0; */
-
strm->avail_in = rlen;
strm->next_in = rbuf;
while (1) {