Because @fxn doesn't stop at simple explanations, I went to dig into why this benchmark give the opposite results of what one would expect 🧵
@fxn As Xavier rightfully pointed out in another thread, the second block is essentially hashing the hashcode a second time, so doing more work, you'd expect it to be slower. And yet, it's twice as fast.
@fxn What is happening is that Ruby hashes use a generic hash function called `rb_any_hash` that knows how to hash arbitrary objects.
Here `a` is the key that was passed (yeah C variable naming!). The second argument is a function pointer, kinda like a Ruby block if you will.