Only #to_sym a key if #to_s doesn't work

Symbols cannot GC'd, so avoid creating them on unknown input if it can
be avoided. This patch is a non-breaking change that shouldn't affect
the performance profile by much in symbol-keyed hashes, but prevents
unbound memory leaks when dealing with large sets of unique keys.

> Symbols are never garbage-collected, so you should not use them for
> situations where you could have an unbounded number of unique
> symbol values.

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/164890