Ruby is a very dynamic language by its nature, and it has quite a generalized interface. Everything is an object,
objects communicate only by sending messages to each other, variables are untyped and everything can be modified at
runtime, even (almost) any of the builtins.
This has a serious drawback, through: evaluating Ruby code is a slow process. Even when you have an expression like 5 +
2 (which is syntactic sugar for 5.+(2)), one cannot safely assume that + method has not been redefined as something
completely different. Thus, one is required to follow the generic method lookup procedure, which
isn’t trivial at all and therefore isn’t fast either.
I have found a way, through, to significantly improve Ruby code performance by restricting just a few of its
metaprogramming capabilities.