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.
diff --git a/Hashtable.c b/Hashtable.c
index 759cbef..f971c8c 100644
--- a/Hashtable.c
+++ b/Hashtable.c
@@ -55,7 +55,7 @@
}
int Hashtable_hashAlgorithm(Hashtable* this, int key) {
- return (key % this->size);
+ return key % this->size;
}
void Hashtable_delete(Hashtable* this) {
@@ -116,17 +116,20 @@
} 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) {