Re: What Impact Do Static HashTables and Classes have on the CPU?



Bruce,

I think you're on to something good here. Let's see what we can come up
with.

1. What are the keys in the hash table? What do they represent?
3. How are they structured?

The keys are GUID and they represent a collection data. A background process
grabs xml from the database and massages it into a struct of arrays.

So the keys are GUID and the values are a struct.

public static Hashtable myHash = Hashtable.Synchronized(new Hashtable());

public struct myStruct
{
public string html;
}

public static String myLogic(String targetID) {
if (myHash.Contains(targetID))
{
lock (myHash.SyncRoot)
{
struct myStruct = (struct)myHash[targetID];
// read data, make decisions based on data, update struct with
results
// struct of arrays greatly simplifed for sake of this
conversation
return myStruct.html;
}
}
}


2. How many keys can there be?

Currently 208, but that will grow to 500 in a couple months and in six
months up to 1000.


4. How (and when) can new keys be created?

Whenever data entry admins change data in the database the hashTable is
updated. This happens a couple hundred times a day. A background process
reads the live hash table, corrilates it's data with the incoming data,
contructs a new seperate hashTable, and once complete, locks the live
hashTable and does a quick swap.




.



Relevant Pages

  • VC6 -> VC2005 conversion problem
    ... struct SHomog ... static void CrossProduct(const SPoint& p, const SPoint& q, SHomog& r) ... returns number of keys ... enabled, disable normalization ...
    (microsoft.public.vc.mfc)
  • Re: USB keyboard problem
    ... The keyboard_t struct kbd is passed to the ukbd_interrupt ... ukbd driver but within the mechanism that fills in ks_ndata. ... Once this has been done, a majority of the keys (a-z, 1-0 ... have found that when you hit any of the modifier keys, ...
    (freebsd-hackers)
  • Re: Using Structs As Dictionary Keys
    ... I've written two- and three-key dictionary wrappers before, but they just gracefully wrap nested Dictionaries, but that seems silly with four keys. ... I thought I was working around that by using a struct; they should always be handled purely as values, such that I could freely create a key once when loading data, and again later when retrieving, and the Dictionary would never know the difference. ... Yes, if you don't specify a comparer for the dictionary, it's using the default EqualityComparer for the key, which will be the ObjectEqualityComparer, which uses the Equals method for comparison. ...
    (microsoft.public.dotnet.framework)
  • Re: re[2]: Com object questions
    ... I took a look at the code that generates the Record info, ... records that don't have a guid ... Looks like it should be possible to create a python record object from ... and when I try to use a struct for the IP address using the following code: ...
    (comp.lang.python)
  • advanced? marshaling
    ... GUID guid; ... typedef struct _CONNMGR_CONNECTIONINFO { ... DWORD dwParams; ... ULONG ulMaxCost; ...
    (microsoft.public.dotnet.framework.compactframework)