2008/3/17, Ken Bloom <kbloom / gmail.com>:
> On Mon, 17 Mar 2008 14:01:51 +0100, Robert Klemme wrote:
>  > - freeze Strings that you are going to use as Hash keys.
>
>
> Is that in any way a speedup hint? or is it just a safety hint? What
>  causes the speedup?

As Jano mentioned it's the skipped #dup for frozen Strings that makes
the speedup.

irb(main):002:0> s="foo"
=> "foo"
irb(main):003:0> h={s=>1}
=> {"foo"=>1}
irb(main):004:0> [s.object_id, h.keys.first.object_id]
=> [1073545320, 1073545340]
irb(main):005:0> s.freeze
=> "foo"
irb(main):006:0> h={s=>1}
=> {"foo"=>1}
irb(main):007:0> [s.object_id, h.keys.first.object_id]
=> [1073545320, 1073545320]
irb(main):008:0>

Kind regards

robert

-- 
use.inject do |as, often| as.you_can - without end