added khash and rearranged benchmarks#6
added khash and rearranged benchmarks#6charlesgregory wants to merge 3 commits intoblachlylab:masterfrom
Conversation
|
If you can add README update explaining the cached parameter looks GTG |
|
I updated the benchmarks (this is also reflected in the readme). I think we should also add a deletion benchmark since that is really where khashl is supposed to shine. |
jblachly
left a comment
There was a problem hiding this comment.
Fix the few issues here and we can merge
| return (a.key == b.key); | ||
| } | ||
|
|
||
| bool kh_hash_equal(T)(T* a, T* b) |
There was a problem hiding this comment.
see nathans/my changes (most recent commit) whereby this template fn needs scope const (really just the const) to correctly instantiate for char * which is not in your unit tests (see also the unit tests I added and add them here)
| { | ||
| /// If using hash-caching we check equality of the hashes first | ||
| /// before checking the equality of keys themselves | ||
| static if(cached) return (a.hash == b.hash) && (strcmp(a, b) == 0); |
There was a problem hiding this comment.
If a is the bucket type does this [strcmp(a,b)] really work? Need char * tests , see above
| { | ||
| pragma(inline, true) | ||
| { | ||
| auto kh_hash_func(T)(T key) |
There was a problem hiding this comment.
Document as Thomas Wang's 32-bit mix function (2002)
http://web.archive.org/web/20060507103516/http://www.cris.com/~Ttwang/tech/inthash.htm
| return key; | ||
| } | ||
|
|
||
| auto kh_hash_func(T)(T key) |
There was a problem hiding this comment.
Thomas Wang's 64-bit mix function (2006)
http://web.archive.org/web/20090408063205/http://www.cris.com/~ttwang/tech/inthash.htm
This is basically a clone of #3 which I messed up due to a rebase. For more information about this pull request visit #3.