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-w32-ef3aabe906a351f0bdf97199b4f38a2c6b54eaa5.tar.gz
busybox-w32-ef3aabe906a351f0bdf97199b4f38a2c6b54eaa5.tar.bz2
busybox-w32-ef3aabe906a351f0bdf97199b4f38a2c6b54eaa5.zip
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 @@
9 9
10#include "libbb.h" 10#include "libbb.h"
11 11
12/* This buys 6% speed for nearly 4k code */ 12#define CONFIG_BZIP2_FEATURE_SPEED 1
13/*#define FAST_GROUP6 1*/ 13
14/* Speed test:
15 * Compiled with gcc 4.2.1, run on Athlon 64 1800 MHz (512K L2 cache).
16 * Stock bzip2 is 26.4% slower than bbox bzip2 at SPEED 1
17 * (time to compress gcc-4.2.1.tar is 126.4% compared to bbox).
18 * At SPEED 5 difference is 32.7%.
19 *
20 * Test run of all CONFIG_BZIP2_FEATURE_SPEED values on a 11Mb text file:
21 * Size Time (3 runs)
22 * 0: 10828 4.145 4.146 4.148
23 * 1: 11097 3.845 3.860 3.861
24 * 2: 11392 3.763 3.767 3.768
25 * 3: 11892 3.722 3.724 3.727
26 * 4: 12740 3.637 3.640 3.644
27 * 5: 17273 3.497 3.509 3.509
28 */
29
30
31#define BZ_DEBUG 0
32/* Takes ~300 bytes, detects corruption caused by bad RAM etc */
33#define BZ_LIGHT_DEBUG 0
14 34
15#include "bz/bzlib.h" 35#include "bz/bzlib.h"
16 36
@@ -19,9 +39,7 @@
19#include "bz/blocksort.c" 39#include "bz/blocksort.c"
20#include "bz/bzlib.c" 40#include "bz/bzlib.c"
21#include "bz/compress.c" 41#include "bz/compress.c"
22#include "bz/crctable.c"
23#include "bz/huffman.c" 42#include "bz/huffman.c"
24#include "bz/randtable.c"
25 43
26/* No point in being shy and having very small buffer here. 44/* No point in being shy and having very small buffer here.
27 * bzip2 internal buffers are much bigger anyway, hundreds of kbytes. 45 * bzip2 internal buffers are much bigger anyway, hundreds of kbytes.
@@ -36,7 +54,7 @@ enum {
36/* Returns: 54/* Returns:
37 * <0 on write errors (examine errno), 55 * <0 on write errors (examine errno),
38 * >0 on short writes (errno == 0) 56 * >0 on short writes (errno == 0)
39 * 0 no error (entire input consume, gimme more) 57 * 0 no error (entire input consumed, gimme more)
40 * on "impossible" errors (internal bzip2 compressor bug) dies 58 * on "impossible" errors (internal bzip2 compressor bug) dies
41 */ 59 */
42static 60static
@@ -44,8 +62,6 @@ ssize_t bz_write(bz_stream *strm, void* rbuf, ssize_t rlen, void *wbuf)
44{ 62{
45 int n, n2, ret; 63 int n, n2, ret;
46 64
47 /* if (len == 0) return 0; */
48
49 strm->avail_in = rlen; 65 strm->avail_in = rlen;
50 strm->next_in = rbuf; 66 strm->next_in = rbuf;
51 while (1) { 67 while (1) {