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-4cae044b436a842e0575c3b6787729fb436fd04c.tar.gz
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 @@
//config: Unless you have a specific application which requires bzip2, you
//config: should probably say N here.
//config:
+//config:config BZIP2_SMALL
+//config: int "Trade bytes for speed (0:fast, 9:small)"
+//config: default 8 # all "fast or small" options default to small
+//config: range 0 9
+//config: depends on BZIP2
+//config: help
+//config: Trade code size versus speed.
+//config: Approximate values with gcc-6.3.0 "bzip -9" compressing
+//config: linux-4.15.tar were:
+//config: value time (sec) code size (386)
+//config: 9 (smallest) 70.11 7687
+//config: 8 67.93 8091
+//config: 7 67.88 8405
+//config: 6 67.78 8624
+//config: 5 67.05 9427
+//config: 4-0 (fastest) 64.14 12083
+//config:
//config:config FEATURE_BZIP2_DECOMPRESS
//config: bool "Enable decompression"
//config: default y
@@ -48,7 +65,11 @@
#include "libbb.h"
#include "bb_archive.h"
-#define CONFIG_BZIP2_FAST 1
+#if CONFIG_BZIP2_SMALL >= 4
+#define BZIP2_SPEED (9 - CONFIG_BZIP2_SMALL)
+#else
+#define BZIP2_SPEED 5
+#endif
/* Speed test:
* Compiled with gcc 4.2.1, run on Athlon 64 1800 MHz (512K L2 cache).
@@ -56,7 +77,7 @@
* (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_FAST values on a 11Mb text file:
+ * Test run of all BZIP2_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