diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2006-07-11 06:13:32 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2006-07-11 06:13:32 +0000 |
commit | 5d48ab8c28925f892e8e7f432f7d2b78c86e95c5 (patch) | |
tree | 13a209d132be00e28d24f9ce750a873055cfbd98 /Hashtable.c | |
parent | 4c41e78bbfe34c67db16bbce8e0241ba583e8572 (diff) |
Performance improvement hackathon: improve process comparison routines,
disable useless code in release builds such as runtime type-checking on
dynamic data structures and process fields that are not being computed,
faster(?) method for verifying the process owner (still need to ensure
correctness), don't destroy and create process objects for hidden kernel
threads over and over. Phew. I shouldn't be doing all this today, but I
could not resist.
Diffstat (limited to 'Hashtable.c')
-rw-r--r-- | Hashtable.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Hashtable.c b/Hashtable.c index 759cbef7..f971c8c2 100644 --- a/Hashtable.c +++ b/Hashtable.c @@ -55,7 +55,7 @@ Hashtable* Hashtable_new(int size, bool owner) { } int Hashtable_hashAlgorithm(Hashtable* this, int key) { - return (key % this->size); + return key % this->size; } void Hashtable_delete(Hashtable* this) { @@ -116,17 +116,20 @@ void* Hashtable_remove(Hashtable* this, int key) { } else bucketPtr = &((*bucketPtr)->next); } - +//#include <stdio.h> inline void* Hashtable_get(Hashtable* this, int key) { int index = this->hashAlgorithm(this, key); HashtableItem* bucketPtr = this->buckets[index]; - while (true) + // fprintf(stderr, "%d -> %d\n", key, index); + while (true) { if (bucketPtr == NULL) { return NULL; } else if (bucketPtr->key == key) { return bucketPtr->value; } else bucketPtr = bucketPtr->next; + // fprintf(stderr, "*\n"); + } } void Hashtable_foreach(Hashtable* this, Hashtable_PairFunction f, void* userData) { |