|
From: Andre R. <and...@us...> - 2004-12-07 11:17:32
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4680 Modified Files: Tag: New_Tables_Experiment-branch langhash.c Log Message: Slight clean up of size check for dynamic allocation of hash buckets. Index: langhash.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/langhash.c,v retrieving revision 1.4.2.21 retrieving revision 1.4.2.22 diff -C2 -d -r1.4.2.21 -r1.4.2.22 *** langhash.c 7 Dec 2004 10:33:13 -0000 1.4.2.21 --- langhash.c 7 Dec 2004 11:17:22 -0000 1.4.2.22 *************** *** 615,619 **** ! static unsigned long ctresizedhashtables = 0; static boolean resizehashtable (hdlhashtable htable, unsigned long newlogsize) { --- 615,630 ---- ! #define checkresizehashtable(ht) \ ! do { /*double bucket array if fill factor > 0.5*/ \ ! if (2 * (**(ht)).ctnodes > (**(ht)).bucketmask) { \ ! (void) resizehashtable ((ht), (**(ht)).logsize + 1); \ ! } \ ! } while(0) ! ! ! #ifdef fldebug ! static unsigned long ctdebugresizedhashtables = 0; ! #endif ! static boolean resizehashtable (hdlhashtable htable, unsigned long newlogsize) { *************** *** 641,645 **** return (true); ! ctresizedhashtables++; ctoldbuckets = 1 << oldlogsize; --- 652,658 ---- return (true); ! #ifdef fldebug ! ctdebugresizedhashtables++; ! #endif ctoldbuckets = 1 << oldlogsize; *************** *** 1704,1724 **** register hdlhashnode hnext; ! //if ((**htable).ctnodes > (1 << (**htable).logsize)) ! if (3 * (**htable).ctnodes > 2 * (1 << (**htable).logsize)) ! { ! ! /*more than 2/3rds full, grow it*/ ! ! unsigned long oldlogsize, newlogsize; ! ! oldlogsize = (**htable).logsize; ! ! //if (oldlogsize < 14) ! // newlogsize = oldlogsize + 2; /*quadruple for 8k items or less*/ ! //else ! newlogsize = oldlogsize + 1; /*double for 16k items or more*/ ! ! (void) resizehashtable (htable, newlogsize); /*ignore return value, our callers don't check for it*/ ! } assert ((**hn).hashval == hashfunction ((**hn).hashkey)); --- 1717,1721 ---- register hdlhashnode hnext; ! checkresizehashtable (htable); assert ((**hn).hashval == hashfunction ((**hn).hashkey)); |