aboutsummaryrefslogtreecommitdiff
path: root/archival/bzip2.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-02-07 01:33:25 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2018-02-07 01:33:25 +0100
commit4cae044b436a842e0575c3b6787729fb436fd04c (patch)
tree4db2a80c44b27bfcbddee47b936f4a55b1315b12 /archival/bzip2.c
parent2b7515722b929794f2f8563b80d9cea48f6b3304 (diff)
downloadbusybox-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/bzip2.c')
-rw-r--r--archival/bzip2.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/archival/bzip2.c b/archival/bzip2.c
index fa906150f..357891ca3 100644
--- a/archival/bzip2.c
+++ b/archival/bzip2.c
@@ -19,6 +19,23 @@
19//config: Unless you have a specific application which requires bzip2, you 19//config: Unless you have a specific application which requires bzip2, you
20//config: should probably say N here. 20//config: should probably say N here.
21//config: 21//config:
22//config:config BZIP2_SMALL
23//config: int "Trade bytes for speed (0:fast, 9:small)"
24//config: default 8 # all "fast or small" options default to small
25//config: range 0 9
26//config: depends on BZIP2
27//config: help
28//config: Trade code size versus speed.
29//config: Approximate values with gcc-6.3.0 "bzip -9" compressing
30//config: linux-4.15.tar were:
31//config: value time (sec) code size (386)
32//config: 9 (smallest) 70.11 7687
33//config: 8 67.93 8091
34//config: 7 67.88 8405
35//config: 6 67.78 8624
36//config: 5 67.05 9427
37//config: 4-0 (fastest) 64.14 12083
38//config:
22//config:config FEATURE_BZIP2_DECOMPRESS 39//config:config FEATURE_BZIP2_DECOMPRESS
23//config: bool "Enable decompression" 40//config: bool "Enable decompression"
24//config: default y 41//config: default y
@@ -48,7 +65,11 @@
48#include "libbb.h" 65#include "libbb.h"
49#include "bb_archive.h" 66#include "bb_archive.h"
50 67
51#define CONFIG_BZIP2_FAST 1 68#if CONFIG_BZIP2_SMALL >= 4
69#define BZIP2_SPEED (9 - CONFIG_BZIP2_SMALL)
70#else
71#define BZIP2_SPEED 5
72#endif
52 73
53/* Speed test: 74/* Speed test:
54 * Compiled with gcc 4.2.1, run on Athlon 64 1800 MHz (512K L2 cache). 75 * Compiled with gcc 4.2.1, run on Athlon 64 1800 MHz (512K L2 cache).
@@ -56,7 +77,7 @@
56 * (time to compress gcc-4.2.1.tar is 126.4% compared to bbox). 77 * (time to compress gcc-4.2.1.tar is 126.4% compared to bbox).
57 * At SPEED 5 difference is 32.7%. 78 * At SPEED 5 difference is 32.7%.
58 * 79 *
59 * Test run of all CONFIG_BZIP2_FAST values on a 11Mb text file: 80 * Test run of all BZIP2_SPEED values on a 11Mb text file:
60 * Size Time (3 runs) 81 * Size Time (3 runs)
61 * 0: 10828 4.145 4.146 4.148 82 * 0: 10828 4.145 4.146 4.148
62 * 1: 11097 3.845 3.860 3.861 83 * 1: 11097 3.845 3.860 3.861