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

function                                             old     new   delta
mainSort                                            1119    1108     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2018-02-03 22:52:11 +01:00
parent 86be6d5ba9
commit 0e60a36c92
2 changed files with 8 additions and 6 deletions

View File

@ -113,9 +113,8 @@ void fallbackQSort3(uint32_t* fmap,
int32_t loSt, int32_t loSt,
int32_t hiSt) int32_t hiSt)
{ {
int32_t unLo, unHi, ltLo, gtHi, n, m; int32_t sp;
int32_t sp, lo, hi; uint32_t r;
uint32_t med, r, r3;
int32_t stackLo[FALLBACK_QSORT_STACK_SIZE]; int32_t stackLo[FALLBACK_QSORT_STACK_SIZE];
int32_t stackHi[FALLBACK_QSORT_STACK_SIZE]; int32_t stackHi[FALLBACK_QSORT_STACK_SIZE];
@ -125,6 +124,11 @@ void fallbackQSort3(uint32_t* fmap,
fpush(loSt, hiSt); fpush(loSt, hiSt);
while (sp > 0) { 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); AssertH(sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004);
fpop(lo, hi); fpop(lo, hi);
@ -730,12 +734,11 @@ void mainSort(EState* state)
{ {
int32_t i, j; int32_t i, j;
Bool bigDone[256]; Bool bigDone[256];
/* bbox: moved to EState to save stack
uint8_t runningOrder[256]; uint8_t runningOrder[256];
/* bbox: moved to EState to save stack
int32_t copyStart[256]; int32_t copyStart[256];
int32_t copyEnd [256]; int32_t copyEnd [256];
*/ */
#define runningOrder (state->mainSort__runningOrder)
#define copyStart (state->mainSort__copyStart) #define copyStart (state->mainSort__copyStart)
#define copyEnd (state->mainSort__copyEnd) #define copyEnd (state->mainSort__copyEnd)

View File

@ -196,7 +196,6 @@ typedef struct EState {
int32_t BZ2_hbMakeCodeLengths__weight[BZ_MAX_ALPHA_SIZE * 2]; int32_t BZ2_hbMakeCodeLengths__weight[BZ_MAX_ALPHA_SIZE * 2];
int32_t BZ2_hbMakeCodeLengths__parent[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__copyStart[256];
int32_t mainSort__copyEnd[256]; int32_t mainSort__copyEnd[256];
} EState; } EState;