Written March 04, 2013 This post is about how I got a 10x speedup for my ruby gem contracts.ruby. contracts.ruby is my project to add code contracts to Ruby. Here's what it looks like: Now, whenever add is called, the parameters and return value will get checked. Cool! 20 seconds This weekend I benchmarked this library and found that it has abysmal performance: This is after running both functions