From: "Marcin Mielżyński" Date: 2007-10-02T23:55:12+09:00 Subject: Re: hash key performance Matthias Wächter wrote: > But here it comes: Using false and, even worse, nil (in either > literal or variable form) is way slower (a good 20%) than using > integers and symbols, even if they follow the same "immutable > object" philosophy of fixed object_ids. > > Why is that? What's so special about false and nil to have such a > degraded performance as a hash key? > hash.c:rb_any_hash is the answer to your question (funcall('hash') is discarded only for Fixnums, Symbols and Strings. Note that String numbers would be way better if it's hash was cached until first destructive operation. lopex