Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> So: don't write huge objects---it's a code smelly anti-pattern anyway

I tend to agree. But even for structures of only say, 4, primitives, it's still faster to only compare two primitives in the common case, instead of hashing 8 and comparing two hashes.

In the same way it could also be argued that needing hash functions for testing equality is a code smell. Equality makes only sense for small clean data structures of primitives. Equality for those should be inferred from the compiler by the primitives' equalities.

Also, how can hash collisions be avoided?



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

Search: