diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-02-07 01:33:25 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-02-07 01:33:25 +0100 |
commit | 4cae044b436a842e0575c3b6787729fb436fd04c (patch) | |
tree | 4db2a80c44b27bfcbddee47b936f4a55b1315b12 /archival/libarchive/bz | |
parent | 2b7515722b929794f2f8563b80d9cea48f6b3304 (diff) | |
download | busybox-w32-4cae044b436a842e0575c3b6787729fb436fd04c.tar.gz busybox-w32-4cae044b436a842e0575c3b6787729fb436fd04c.tar.bz2 busybox-w32-4cae044b436a842e0575c3b6787729fb436fd04c.zip |
bzip2: expose tuning knob for faster/smaller code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libarchive/bz')
-rw-r--r-- | archival/libarchive/bz/blocksort.c | 8 | ||||
-rw-r--r-- | archival/libarchive/bz/bzlib_private.h | 2 | ||||
-rw-r--r-- | archival/libarchive/bz/compress.c | 24 | ||||
-rw-r--r-- | archival/libarchive/bz/huffman.c | 2 |
4 files changed, 18 insertions, 18 deletions
diff --git a/archival/libarchive/bz/blocksort.c b/archival/libarchive/bz/blocksort.c index 0a9a597d0..92d6d8251 100644 --- a/archival/libarchive/bz/blocksort.c +++ b/archival/libarchive/bz/blocksort.c | |||
@@ -392,7 +392,7 @@ int mainGtU(EState* state, | |||
392 | * but speeds up compression 10% overall | 392 | * but speeds up compression 10% overall |
393 | */ | 393 | */ |
394 | 394 | ||
395 | #if CONFIG_BZIP2_FAST >= 1 | 395 | #if BZIP2_SPEED >= 1 |
396 | 396 | ||
397 | #define TIMES_8(code) \ | 397 | #define TIMES_8(code) \ |
398 | code; code; code; code; \ | 398 | code; code; code; code; \ |
@@ -506,7 +506,7 @@ void mainSimpleSort(EState* state, | |||
506 | i++; | 506 | i++; |
507 | 507 | ||
508 | /* 1.5% overall speedup, +290 bytes */ | 508 | /* 1.5% overall speedup, +290 bytes */ |
509 | #if CONFIG_BZIP2_FAST >= 3 | 509 | #if BZIP2_SPEED >= 3 |
510 | /*-- copy 2 --*/ | 510 | /*-- copy 2 --*/ |
511 | if (i > hi) break; | 511 | if (i > hi) break; |
512 | v = ptr[i]; | 512 | v = ptr[i]; |
@@ -755,7 +755,7 @@ void mainSort(EState* state) | |||
755 | j = block[0] << 8; | 755 | j = block[0] << 8; |
756 | i = nblock - 1; | 756 | i = nblock - 1; |
757 | /* 3%, +300 bytes */ | 757 | /* 3%, +300 bytes */ |
758 | #if CONFIG_BZIP2_FAST >= 2 | 758 | #if BZIP2_SPEED >= 2 |
759 | for (; i >= 3; i -= 4) { | 759 | for (; i >= 3; i -= 4) { |
760 | quadrant[i] = 0; | 760 | quadrant[i] = 0; |
761 | j = (j >> 8) | (((unsigned)block[i]) << 8); | 761 | j = (j >> 8) | (((unsigned)block[i]) << 8); |
@@ -794,7 +794,7 @@ void mainSort(EState* state) | |||
794 | unsigned s; | 794 | unsigned s; |
795 | s = block[0] << 8; | 795 | s = block[0] << 8; |
796 | i = nblock - 1; | 796 | i = nblock - 1; |
797 | #if CONFIG_BZIP2_FAST >= 2 | 797 | #if BZIP2_SPEED >= 2 |
798 | for (; i >= 3; i -= 4) { | 798 | for (; i >= 3; i -= 4) { |
799 | s = (s >> 8) | (block[i] << 8); | 799 | s = (s >> 8) | (block[i] << 8); |
800 | j = ftab[s] - 1; | 800 | j = ftab[s] - 1; |
diff --git a/archival/libarchive/bz/bzlib_private.h b/archival/libarchive/bz/bzlib_private.h index ef75ef08a..ea0f29b7c 100644 --- a/archival/libarchive/bz/bzlib_private.h +++ b/archival/libarchive/bz/bzlib_private.h | |||
@@ -188,7 +188,7 @@ typedef struct EState { | |||
188 | /* stack-saving measures: these can be local, but they are too big */ | 188 | /* stack-saving measures: these can be local, but they are too big */ |
189 | int32_t sendMTFValues__code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; | 189 | int32_t sendMTFValues__code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; |
190 | int32_t sendMTFValues__rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; | 190 | int32_t sendMTFValues__rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; |
191 | #if CONFIG_BZIP2_FAST >= 5 | 191 | #if BZIP2_SPEED >= 5 |
192 | /* second dimension: only 3 needed; 4 makes index calculations faster */ | 192 | /* second dimension: only 3 needed; 4 makes index calculations faster */ |
193 | uint32_t sendMTFValues__len_pack[BZ_MAX_ALPHA_SIZE][4]; | 193 | uint32_t sendMTFValues__len_pack[BZ_MAX_ALPHA_SIZE][4]; |
194 | #endif | 194 | #endif |
diff --git a/archival/libarchive/bz/compress.c b/archival/libarchive/bz/compress.c index 462740b6c..539ab927e 100644 --- a/archival/libarchive/bz/compress.c +++ b/archival/libarchive/bz/compress.c | |||
@@ -32,6 +32,12 @@ in the file LICENSE. | |||
32 | 32 | ||
33 | /* #include "bzlib_private.h" */ | 33 | /* #include "bzlib_private.h" */ |
34 | 34 | ||
35 | #if BZIP2_SPEED >= 5 | ||
36 | # define ALWAYS_INLINE_5 ALWAYS_INLINE | ||
37 | #else | ||
38 | # define ALWAYS_INLINE_5 /*nothing*/ | ||
39 | #endif | ||
40 | |||
35 | /*---------------------------------------------------*/ | 41 | /*---------------------------------------------------*/ |
36 | /*--- Bit stream I/O ---*/ | 42 | /*--- Bit stream I/O ---*/ |
37 | /*---------------------------------------------------*/ | 43 | /*---------------------------------------------------*/ |
@@ -60,9 +66,7 @@ void bsFinishWrite(EState* s) | |||
60 | /*---------------------------------------------------*/ | 66 | /*---------------------------------------------------*/ |
61 | static | 67 | static |
62 | /* Helps only on level 5, on other levels hurts. ? */ | 68 | /* Helps only on level 5, on other levels hurts. ? */ |
63 | #if CONFIG_BZIP2_FAST >= 5 | 69 | ALWAYS_INLINE_5 |
64 | ALWAYS_INLINE | ||
65 | #endif | ||
66 | void bsW(EState* s, int32_t n, uint32_t v) | 70 | void bsW(EState* s, int32_t n, uint32_t v) |
67 | { | 71 | { |
68 | while (s->bsLive >= 8) { | 72 | while (s->bsLive >= 8) { |
@@ -75,9 +79,7 @@ void bsW(EState* s, int32_t n, uint32_t v) | |||
75 | } | 79 | } |
76 | /* Same with n == 16: */ | 80 | /* Same with n == 16: */ |
77 | static | 81 | static |
78 | #if CONFIG_BZIP2_FAST >= 5 | 82 | ALWAYS_INLINE_5 |
79 | ALWAYS_INLINE | ||
80 | #endif | ||
81 | void bsW16(EState* s, uint32_t v) | 83 | void bsW16(EState* s, uint32_t v) |
82 | { | 84 | { |
83 | while (s->bsLive >= 8) { | 85 | while (s->bsLive >= 8) { |
@@ -103,9 +105,7 @@ void bsW1_1(EState* s) | |||
103 | s->bsLive += 1; | 105 | s->bsLive += 1; |
104 | } | 106 | } |
105 | static | 107 | static |
106 | #if CONFIG_BZIP2_FAST >= 5 | 108 | ALWAYS_INLINE_5 |
107 | ALWAYS_INLINE | ||
108 | #endif | ||
109 | void bsW1_0(EState* s) | 109 | void bsW1_0(EState* s) |
110 | { | 110 | { |
111 | /* need space for only 1 bit, no need for loop freeing > 8 bits */ | 111 | /* need space for only 1 bit, no need for loop freeing > 8 bits */ |
@@ -394,7 +394,7 @@ void sendMTFValues(EState* s) | |||
394 | s->rfreq[t][v] = 0; | 394 | s->rfreq[t][v] = 0; |
395 | } | 395 | } |
396 | 396 | ||
397 | #if CONFIG_BZIP2_FAST >= 5 | 397 | #if BZIP2_SPEED >= 5 |
398 | /* | 398 | /* |
399 | * Set up an auxiliary length table which is used to fast-track | 399 | * Set up an auxiliary length table which is used to fast-track |
400 | * the common case (nGroups == 6). | 400 | * the common case (nGroups == 6). |
@@ -427,7 +427,7 @@ void sendMTFValues(EState* s) | |||
427 | */ | 427 | */ |
428 | for (t = 0; t < nGroups; t++) | 428 | for (t = 0; t < nGroups; t++) |
429 | cost[t] = 0; | 429 | cost[t] = 0; |
430 | #if CONFIG_BZIP2_FAST >= 5 | 430 | #if BZIP2_SPEED >= 5 |
431 | if (nGroups == 6 && 50 == ge-gs+1) { | 431 | if (nGroups == 6 && 50 == ge-gs+1) { |
432 | /*--- fast track the common case ---*/ | 432 | /*--- fast track the common case ---*/ |
433 | register uint32_t cost01, cost23, cost45; | 433 | register uint32_t cost01, cost23, cost45; |
@@ -483,7 +483,7 @@ void sendMTFValues(EState* s) | |||
483 | * Increment the symbol frequencies for the selected table. | 483 | * Increment the symbol frequencies for the selected table. |
484 | */ | 484 | */ |
485 | /* 1% faster compress. +800 bytes */ | 485 | /* 1% faster compress. +800 bytes */ |
486 | #if CONFIG_BZIP2_FAST >= 4 | 486 | #if BZIP2_SPEED >= 4 |
487 | if (nGroups == 6 && 50 == ge-gs+1) { | 487 | if (nGroups == 6 && 50 == ge-gs+1) { |
488 | /*--- fast track the common case ---*/ | 488 | /*--- fast track the common case ---*/ |
489 | #define BZ_ITUR(nn) s->rfreq[bt][mtfv[gs + (nn)]]++ | 489 | #define BZ_ITUR(nn) s->rfreq[bt][mtfv[gs + (nn)]]++ |
diff --git a/archival/libarchive/bz/huffman.c b/archival/libarchive/bz/huffman.c index be5930e00..dc851cd3f 100644 --- a/archival/libarchive/bz/huffman.c +++ b/archival/libarchive/bz/huffman.c | |||
@@ -48,7 +48,7 @@ in the file LICENSE. | |||
48 | 48 | ||
49 | 49 | ||
50 | /* 90 bytes, 0.3% of overall compress speed */ | 50 | /* 90 bytes, 0.3% of overall compress speed */ |
51 | #if CONFIG_BZIP2_FAST >= 1 | 51 | #if BZIP2_SPEED >= 1 |
52 | 52 | ||
53 | /* macro works better than inline (gcc 4.2.1) */ | 53 | /* macro works better than inline (gcc 4.2.1) */ |
54 | #define DOWNHEAP1(heap, weight, Heap) \ | 54 | #define DOWNHEAP1(heap, weight, Heap) \ |