From 867f0037a851c641d4b6a3b429ce851613c22e0c Mon Sep 17 00:00:00 2001 From: jkh Date: Tue, 9 Feb 1999 16:04:19 +0000 Subject: [PATCH] Remove dictHashSummary internal function; it used doubles. Submitted by: Daniel C. Sobral --- sys/boot/ficl/dict.c | 77 ------------------------------------------- sys/boot/ficl/ficl.h | 1 - sys/boot/ficl/words.c | 1 - 3 files changed, 79 deletions(-) diff --git a/sys/boot/ficl/dict.c b/sys/boot/ficl/dict.c index 640a2fddc1ad..5b45a8717b79 100644 --- a/sys/boot/ficl/dict.c +++ b/sys/boot/ficl/dict.c @@ -396,83 +396,6 @@ void dictEmpty(FICL_DICT *pDict, unsigned nHash) } -/************************************************************************** - d i c t H a s h S u m m a r y -** Calculate a figure of merit for the dictionary hash table based -** on the average search depth for all the words in the dictionary, -** assuming uniform distribution of target keys. The figure of merit -** is the ratio of the total search depth for all keys in the table -** versus a theoretical optimum that would be achieved if the keys -** were distributed into the table as evenly as possible. -** The figure would be worse if the hash table used an open -** addressing scheme (i.e. collisions resolved by searching the -** table for an empty slot) for a given size table. -**************************************************************************/ -void dictHashSummary(FICL_VM *pVM) -{ - FICL_DICT *dp = ficlGetDict(); - FICL_HASH *pFHash; - FICL_WORD **pHash; - unsigned size; - FICL_WORD *pFW; - unsigned i; - int nMax = 0; - int nWords = 0; - int nFilled; - double avg = 0.0; - double best; - int nAvg, nRem, nDepth; - - dictCheck(dp, pVM, 0); - - pFHash = dp->pSearch[dp->nLists - 1]; - pHash = pFHash->table; - size = pFHash->size; - nFilled = size; - - for (i = 0; i < size; i++) - { - int n = 0; - pFW = pHash[i]; - - while (pFW) - { - ++n; - ++nWords; - pFW = pFW->link; - } - - avg += (double)(n * (n+1)) / 2.0; - - if (n > nMax) - nMax = n; - if (n == 0) - --nFilled; - } - - /* Calc actual avg search depth for this hash */ - avg = avg / nWords; - - /* Calc best possible performance with this size hash */ - nAvg = nWords / size; - nRem = nWords % size; - nDepth = size * (nAvg * (nAvg+1))/2 + (nAvg+1)*nRem; - best = (double)nDepth/nWords; - - sprintf(pVM->pad, - "%d bins, %2.0f%% filled, Depth: Max=%d, Avg=%2.1f, Best=%2.1f, Score: %2.0f%%", - size, - (double)nFilled * 100.0 / size, nMax, - avg, - best, - 100.0 * best / avg); - - ficlTextOut(pVM, pVM->pad, 1); - - return; -} - - /************************************************************************** d i c t I n c l u d e s ** Returns TRUE iff the given pointer is within the address range of diff --git a/sys/boot/ficl/ficl.h b/sys/boot/ficl/ficl.h index 644a700cf7fb..e0536e6086e0 100644 --- a/sys/boot/ficl/ficl.h +++ b/sys/boot/ficl/ficl.h @@ -668,7 +668,6 @@ FICL_DICT *dictCreate(unsigned nCELLS); FICL_DICT *dictCreateHashed(unsigned nCells, unsigned nHash); void dictDelete(FICL_DICT *pDict); void dictEmpty(FICL_DICT *pDict, unsigned nHash); -void dictHashSummary(FICL_VM *pVM); int dictIncludes(FICL_DICT *pDict, void *p); FICL_WORD *dictLookup(FICL_DICT *pDict, STRINGINFO si); #if FICL_WANT_LOCALS diff --git a/sys/boot/ficl/words.c b/sys/boot/ficl/words.c index dadeaaa60414..e86f25ff05b4 100644 --- a/sys/boot/ficl/words.c +++ b/sys/boot/ficl/words.c @@ -4744,7 +4744,6 @@ void ficlCompileCore(FICL_DICT *dp) ** Ficl extras */ dictAppendWord(dp, ".env", listEnv, FW_DEFAULT); - dictAppendWord(dp, ".hash", dictHashSummary,FW_DEFAULT); dictAppendWord(dp, ".ver", ficlVersion, FW_DEFAULT); dictAppendWord(dp, "-roll", minusRoll, FW_DEFAULT); dictAppendWord(dp, "2constant", twoConstant, FW_IMMEDIATE); /* DOUBLE */