Celebrity.all.map(&:id)
=> Time: 3.925s
Celebrity.select(:id).map(&:id)
=> Time: 0.098s
Celebrity.pluck(:id)
=> Time: 0.009s
pluck directly converts a database result into an array, without constructing ActiveRecord objects.
long_string = 'foo' * 10000000
long_string += 'foo'
=> Time: 0.0862s
long_string << 'foo'
=> Time: 0.00003s
long_string + long_string
=> Time: 0.20s
"#{long_string} #{long_string}"
=> Time: 0.04s