Where it's easy to do so, build extended classes at compile time

This won't eliminate the calls to Object#extend which flush ruby's method
cache, but it will greatly reduce them at relatively little cost.