While skimming through db.c I noticed that the helpfile keywords and the text itself was being loaded into the hash tables. My understanding of hashtables is that they are only truly benefitical if the string is allocated frequently. Like a mob's name. Is there a particular reason why the help file keywords and the text is loaded into the hash tables? Afterall, what is likelyhood that those particular strings would be allocated again?
As a test I used the 'memory hash' command to get these stats:
(w/ help hashing)
Hash strings allocated: 11246 Total links : 56616
String bytes allocated: 1475140 Bytes saved : 802275
Unique (wasted) links : 7388 Hi-Link count: 27932
(wo/ hashing)
Hash strings allocated: 9823 Total links : 55276
String bytes allocated: 1084862 Bytes saved : 813839
Unique (wasted) links : 5965 Hi-Link count: 28006
I not only decreased my unique links but I increased my saved bytes. Anyone have a good reason why this shouldn't be done?
All I changed was this bit of code in load_helps:
pHelp->level = fread_number( fp );
pHelp->keyword = fread_string_nohash( fp );
if ( pHelp->keyword[0] == '$' )
break;
pHelp->text = fread_string_nohash( fp );
Changing both 'fread_string_nohash' from their original 'fread_string'
As a test I used the 'memory hash' command to get these stats:
(w/ help hashing)
Hash strings allocated: 11246 Total links : 56616
String bytes allocated: 1475140 Bytes saved : 802275
Unique (wasted) links : 7388 Hi-Link count: 27932
(wo/ hashing)
Hash strings allocated: 9823 Total links : 55276
String bytes allocated: 1084862 Bytes saved : 813839
Unique (wasted) links : 5965 Hi-Link count: 28006
I not only decreased my unique links but I increased my saved bytes. Anyone have a good reason why this shouldn't be done?
All I changed was this bit of code in load_helps:
pHelp->level = fread_number( fp );
pHelp->keyword = fread_string_nohash( fp );
if ( pHelp->keyword[0] == '$' )
break;
pHelp->text = fread_string_nohash( fp );
Changing both 'fread_string_nohash' from their original 'fread_string'