6 ms·
Just looking at the first lines of the linked code, I see the following: // Define a custom hash function to use instead of khash's default hash // functio
by _ph_ 6y ago
Just looking at the first lines of the linked code, I see the following:
// Define a custom hash function to use instead of khash's default hash
// function. This custom hash function uses a simpler bit shift and XOR which
// results in several percent faster performance compared to when khash's
// default hash function is used.
quite contradicting your statement.
- igouy 6y agoAgain, for the benchmarks game, C is not free to implement an optimized hash table for the problem. Any of the programs are free to implement a "custom hash function" and many of them do. hash table != hash function
- _ph_ 6y agoThat is picking terms. Many languages don't allow to specify custom hash functions, so you can't specify the hash functions until you do write a custom hash table. A fair benchmark would allow for this, if it is allowed in C.
- igouy 6y agoThe OP "Performance comparison: counting words in Python, Go, C++, C, Awk, Forth, Rust" does not allow external libraries BUT then makes an exception for C, and then makes a further exception -- In the optimized version we’ll roll our own hash table. Wikipedia is your friend -- "A hash table uses a hash function to compute an index, also called a hash code …" Which languages shown on the benchmarks game website 'don't allow to specify custom hash functions …" ? https://en.wikipedia.org/wiki/Hash_function https://en.wikipedia.org/wiki/Hash_function
- _ph_ 6y agoI was not talking about the article but the benchmark site linked. Not sure what you want to say with the wikipedia citation. I have not made a comprehensive list, but the topic has come up when discussing one of the Go benchmarks. The Go language has a build-in hashtable, called a map, and this does not allow to specify custom hash functions. Of course rolling out a hashtable implementation which does allow this is prohibited by the benchmark rules. Probably intentionally, also like your distraction attempts are hinting to.
- igouy 6y agoSo you say "Many languages don't allow to specify custom hash functions" but can only name one? > Probably intentionally Wow.