|
From: Christoph B. <bar...@or...> - 2007-07-20 12:42:23
|
> That is my understanding, too. > I pretty much would like a general resizable hash table in Valgrind core; > something like the one you posted (in topic "Long valgrind runtimes"). > > I use them a lot in callgrind for different structures, but have my own > implementation(s). > > However, Vg_HashTable uses a simply key for entry comparision, which is > not enough in some cases. What about an optional comparision callback? Yes, I am currently working on a m_hashtable.c that uses open adressing with linear probing. Each table entry stores a pointer to the item. The user supplies three functions to the implementation: - A function that calculates the hash of an entry. The default would be to return the key. The hash modulo the table size is the bucket of the entry. - A function that compares two entries for equality. The default would be to only compare keys. - A function that deletes the items in the hash table. On the one hand this acts as a destructor that is able to clean up other allocations. On the other hand this allows the usage of the arena_malloc_fast/arena_free_fast pair of functions. I hope that such an implementation is at least as fast as the current one and that it allows me to use less memory for the execution context by getting rid of a pointer. This would reduce the size of an execution context in my implementation from 16 bytes (4 bytes padding) to 8 bytes. Greetings Christoph |