[git commit] bzip2: move runningOrder[] back to stack - 256 bytes is not much

Denys Vlasenko vda.linux at googlemail.com
Sat Feb 3 21:52:55 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=0e60a36c929e57e47d5de8e1ac0e53d4ec185a70
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
mainSort                                            1119    1108     -11

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 archival/libarchive/bz/blocksort.c     | 13 ++++++++-----
 archival/libarchive/bz/bzlib_private.h |  1 -
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/archival/libarchive/bz/blocksort.c b/archival/libarchive/bz/blocksort.c
index 7c5b6c552..0a9a597d0 100644
--- a/archival/libarchive/bz/blocksort.c
+++ b/archival/libarchive/bz/blocksort.c
@@ -113,9 +113,8 @@ void fallbackQSort3(uint32_t* fmap,
 		int32_t   loSt,
 		int32_t   hiSt)
 {
-	int32_t unLo, unHi, ltLo, gtHi, n, m;
-	int32_t sp, lo, hi;
-	uint32_t med, r, r3;
+	int32_t sp;
+	uint32_t r;
 	int32_t stackLo[FALLBACK_QSORT_STACK_SIZE];
 	int32_t stackHi[FALLBACK_QSORT_STACK_SIZE];
 
@@ -125,6 +124,11 @@ void fallbackQSort3(uint32_t* fmap,
 	fpush(loSt, hiSt);
 
 	while (sp > 0) {
+		int32_t unLo, unHi, ltLo, gtHi, n, m;
+		int32_t lo, hi;
+		uint32_t med;
+		uint32_t r3;
+
 		AssertH(sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004);
 
 		fpop(lo, hi);
@@ -730,12 +734,11 @@ void mainSort(EState* state)
 {
 	int32_t  i, j;
 	Bool     bigDone[256];
-	/* bbox: moved to EState to save stack
 	uint8_t  runningOrder[256];
+	/* bbox: moved to EState to save stack
 	int32_t  copyStart[256];
 	int32_t  copyEnd  [256];
 	*/
-#define runningOrder (state->mainSort__runningOrder)
 #define copyStart    (state->mainSort__copyStart)
 #define copyEnd      (state->mainSort__copyEnd)
 
diff --git a/archival/libarchive/bz/bzlib_private.h b/archival/libarchive/bz/bzlib_private.h
index 8b8bbe3eb..ef75ef08a 100644
--- a/archival/libarchive/bz/bzlib_private.h
+++ b/archival/libarchive/bz/bzlib_private.h
@@ -196,7 +196,6 @@ typedef struct EState {
 	int32_t  BZ2_hbMakeCodeLengths__weight[BZ_MAX_ALPHA_SIZE * 2];
 	int32_t  BZ2_hbMakeCodeLengths__parent[BZ_MAX_ALPHA_SIZE * 2];
 
-	uint8_t  mainSort__runningOrder[256];
 	int32_t  mainSort__copyStart[256];
 	int32_t  mainSort__copyEnd[256];
 } EState;


More information about the busybox-cvs mailing list