News for hackers. Stuff that matters.
Re:Moving from Ruby to Rust by chrisseaton on Friday February 15, 2019 @08:33AM (#19170743)
> as of Ruby 2.2, there are zero-performance gains using symbols over strings

As others have pointed out - this is demonstrably false.

    # frozen_string_literal: true

    a = ('fo' + 'o').to_sym
    :foo == a

    b = ('fo' + 'o').freeze
    'foo' == b
The second comparison is a 1.5x slower than the former. This is because if a string comparison fails on identity, it then has to check characters. Symbols are always interned so can always stop as the identity comparison.

But I actually just like them as they convey intent - a symbol is a string I know about as the programmer. A string is a string that is runtime data.

Re:Moving from Ruby to Rust by jaequery on Friday February 15, 2019 @11:00AM (#19171908)
I too like it as you. But I find when dealing with a lot of JSON data (decoding/encoding) the symbols become a hindrance.