|
From: Andre R. <and...@us...> - 2004-11-10 17:21:59
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8410 Modified Files: Tag: New_Tables_Experiment-branch frontierdefs.h lang.h langinternal.h Log Message: First step towards an overhaul of the hashtable type: Switched to a hash function with a wider spread. Prepare for allocating and resizing the hash bucket array dynamically by caching the hash function result in each hash node and moving the hash bucket array out of the hash node handle and into its own handle. All significant changes ifdef'd for flv10tables, to be defined in frontierdefs.h. Index: lang.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/lang.h,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -C2 -d -r1.4 -r1.4.2.1 *** lang.h 31 Oct 2004 21:42:48 -0000 1.4 --- lang.h 10 Nov 2004 17:21:43 -0000 1.4.2.1 *************** *** 437,440 **** --- 437,446 ---- byte ctlocks: 8; + #ifdef flv10tables + + unsigned long hashval; /*2004-11-10 aradke: cache of hashfunction(hashkey)*/ + + #endif + byte hashkey []; /*the identifier of this table element, lives in extension of record*/ *************** *** 444,450 **** #define HNoNode ((hdlhashnode) -1) #define gethashkey(h,bs) copystring ((**h).hashkey, bs); ! #define ctbuckets 11 /*should be a prime number?*/ --- 450,474 ---- #define HNoNode ((hdlhashnode) -1) #define gethashkey(h,bs) copystring ((**h).hashkey, bs); + + #ifdef flv10tables ! #define ctinitialbuckets 11 ! ! typedef hdlhashnode **hdlhashbucketarray; ! ! #define nthhashbucket(ht,i) ((*((**(ht)).hbuckets))[i]) ! ! #define gethashbucketcount(ht) ((**(ht)).ctbuckets) ! ! #else ! ! #define ctbuckets 11 /*should be a prime number?*/ ! ! #define nthhashbucket(ht,i) ((**(ht)).hashbucket[i]) ! ! #define gethashbucketcount(ht) ctbuckets ! ! #endif *************** *** 454,459 **** typedef struct tyhashtable { ! hdlhashnode hashbucket [ctbuckets]; hdlhashnode hfirstsort; /*the alphabetically-first hash node*/ --- 478,493 ---- typedef struct tyhashtable { ! #ifdef flv10tables + unsigned long ctbuckets; + + hdlhashbucketarray hbuckets; + + #else + + hdlhashnode hashbucket [ctbuckets]; + + #endif + hdlhashnode hfirstsort; /*the alphabetically-first hash node*/ Index: frontierdefs.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/frontierdefs.h,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** frontierdefs.h 1 Nov 2004 13:54:29 -0000 1.2 --- frontierdefs.h 10 Nov 2004 17:21:42 -0000 1.2.2.1 *************** *** 76,79 **** --- 76,81 ---- #undef lazythis_optimization #undef langexternalfind_optimization + #define flv10tables 1 /* 2004-11-10 aradke: for new hash table implementation [EXPERIMENTAL] */ + #define PASCALSTRINGVERSION 1 #define SPEED 1 Index: langinternal.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/langinternal.h,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** langinternal.h 28 Oct 2004 23:07:31 -0000 1.3 --- langinternal.h 10 Nov 2004 17:21:46 -0000 1.3.2.1 *************** *** 416,420 **** extern boolean hashflushcache (long *); /*langhash.h*/ ! extern short hashfunction (const bigstring); extern boolean hashresolvevalue (hdlhashtable, hdlhashnode); --- 416,424 ---- extern boolean hashflushcache (long *); /*langhash.h*/ ! #ifdef flv10tables ! extern unsigned long hashfunction (const bigstring); /* 2004-11-10 aradke */ ! #else ! extern short hashfunction (const bigstring); ! #endif extern boolean hashresolvevalue (hdlhashtable, hdlhashnode); |