rails/rails — comment on commit 12be0a59856d4f92a85c479843e296342be47789
File:  line 0
By tenderlove:

@josevalim it consumes less memory when the strings are keys to a hash. If the keys are strings, hashes will dup them unless they are frozen.

```ruby

require 'minitest/autorun'

class HashTest < MiniTest::Unit::TestCase
def test_hash_key_dups
x = "hi mom"
z = { x => :y }
refute_equal x.object_id, z.keys.first.object_id
end

###
# Freezing prevents hashes from duping strings when strings are keys.
def test_frozen_does_not_dup
x = "hi mom".freeze
z = { x => :y }
assert_equal x.object_id, z.keys.first.object_id
end
end
```