Hacker News new | past | comments | ask | show | jobs | submit login

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.



Again, 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


That 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.


The 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


I 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.


So you say "Many languages don't allow to specify custom hash functions" but can only name one?

> Probably intentionally

Wow.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: