Re: What Impact Do Static HashTables and Classes have on the CPU?
- From: "Mark S." <marks@xxxxxxxxx>
- Date: Thu, 29 Mar 2007 12:20:21 +0900
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.
.
- References:
- What Impact Do Static HashTables and Classes have on the CPU?
- From: Mark S.
- Re: What Impact Do Static HashTables and Classes have on the CPU?
- From: Alberto Poblacion
- Re: What Impact Do Static HashTables and Classes have on the CPU?
- From: Mark S.
- Re: What Impact Do Static HashTables and Classes have on the CPU?
- From: Bruce Wood
- What Impact Do Static HashTables and Classes have on the CPU?
- Prev by Date: Re: Generated code for DataGridView and Update
- Next by Date: Regular Expression for currency
- Previous by thread: Re: What Impact Do Static HashTables and Classes have on the CPU?
- Next by thread: Re: What Impact Do Static HashTables and Classes have on the CPU?
- Index(es):
Relevant Pages
|
|