dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/support hashtab.c,1.3,1.4 intern.c,1.2,1


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/support hashtab.c,1.3,1.4 intern.c,1.2,1.3
Date: Sat, 21 Jun 2003 21:20:38 -0400

Update of /cvsroot/dotgnu-pnet/pnet/support
In directory subversions:/tmp/cvs-serv2075/support

Modified Files:
        hashtab.c intern.c 
Log Message:


Adjust some hash table sizes to be prime numbers rather than powers of two,
to help spread items more evenly across the table.


Index: hashtab.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/hashtab.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** hashtab.c   1 Aug 2002 05:46:58 -0000       1.3
--- hashtab.c   22 Jun 2003 01:20:35 -0000      1.4
***************
*** 73,77 ****
        if(!size)
        {
!               size = 512;
        }
        if((hashtab = (ILHashTable *)ILCalloc(1, sizeof(ILHashTable) +
--- 73,77 ----
        if(!size)
        {
!               size = 509;
        }
        if((hashtab = (ILHashTable *)ILCalloc(1, sizeof(ILHashTable) +

Index: intern.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/support/intern.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** intern.c    15 May 2003 02:46:28 -0000      1.2
--- intern.c    22 Jun 2003 01:20:35 -0000      1.3
***************
*** 37,41 ****
  
  } InternEntry;
! #define       INTERN_HASH_SIZE                2048
  static InternEntry *hashTable[INTERN_HASH_SIZE];
  static char emptyString[] = "";
--- 37,41 ----
  
  } InternEntry;
! #define       INTERN_HASH_SIZE                2039
  static InternEntry *hashTable[INTERN_HASH_SIZE];
  static char emptyString[] = "";
***************
*** 62,66 ****
  
        /* Hash the string */
!       hash = (ILHashString(0, str, len) & (INTERN_HASH_SIZE - 1));
  
        /* Look in the hash table to see if we already have the string */
--- 62,66 ----
  
        /* Hash the string */
!       hash = (ILHashString(0, str, len) % INTERN_HASH_SIZE);
  
        /* Look in the hash table to see if we already have the string */
***************
*** 120,124 ****
        hash = ILHashString(0, str1.string, str1.len);
        hash = ILHashString(hash, str2.string, str2.len);
!       hash &= (INTERN_HASH_SIZE - 1);
  
        /* Look in the hash table to see if we already have the combined string 
*/
--- 120,124 ----
        hash = ILHashString(0, str1.string, str1.len);
        hash = ILHashString(hash, str2.string, str2.len);
!       hash %= INTERN_HASH_SIZE;
  
        /* Look in the hash table to see if we already have the combined string 
*/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]