-
Notifications
You must be signed in to change notification settings - Fork 5
added khash and rearranged benchmarks #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.