Being able to rewrite a small section of ruby code in C is a great way to speed up some types of manipulations. This has yielded me two magnitudes of speedup multiple times in my career so far.
Here's an example using RubyInline, which is a gem that handles the compilation step for you:
Here's an example using RubyInline, which is a gem that handles the compilation step for you:
http://stevenjewel.com/2013/11/detecting-headphone-use/