Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby Comparison Performance Comparison

Chad Taylor
September 22, 2012

Ruby Comparison Performance Comparison

Data to help you pick the fastest string equality operation in Ruby. Presented as a lightning talk at Ruby Hoedown 2012.

Chad Taylor

September 22, 2012
Tweet

More Decks by Chad Taylor

Other Decks in Programming

Transcript

  1. Which is faster? “x” == “x” :x == :x @tessellator

    https://github.com/tessellator/so2db
  2. 0 1.25 2.5 3.75 5 1k 10k 100k 1M 10M

    “x” == “x” :x == :x @tessellator https://github.com/tessellator/so2db
  3. 0 0.001 0.01 0.1 1 10 100 1k 10k 100k

    1M 10M 100M “x” == “x” :x == :x @tessellator https://github.com/tessellator/so2db Log Scale!
  4. Which is fastest? “x”.to_sym == :x “x” == :x.to_s “x”

    == “x” “x” == @x @tessellator https://github.com/tessellator/so2db
  5. 0 17.5 35 52.5 70 1k 10k 100k 1M 10M

    100M “x”.to_sym == :x “x” == :x.to_s “x” == “x” “x” == @x @tessellator https://github.com/tessellator/so2db
  6. 0 0.001 0.01 0.1 1 10 100 1k 10k 100k

    1M 10M 100M “x”.to_sym == :x “x” == :x.to_s “x” == “x” “x” == @x @tessellator https://github.com/tessellator/so2db Log Scale!