Fast Ruby
In Erik Michaels-Ober's great talk Writing Fast Ruby: Video @ Baruco 2014, Slide, he presents us many idioms that leads to Faster Ruby. He inspired me and I want to document these to let more people know. I try to link to real commit for people to see this can really benefits in real world. But this does not mean you can always replace one with another, depends on the context (e.g. gsub
versus tr
). Use with caution!
Each idiom has a corresponding code example resides in code.
All results with Ruby 2.2.0-preview1 on OS X 10.9.4. Your results may vary but you get the idea. : )
Let's write faster code, together! <3