Optimizing Ruby starts with profiling to find the real bottleneck — never guessing. Ruby is relatively slow (interpreted, dynamic), so optimization focuses on better algorithms, reducing object allocation, fixing database queries (the usual culprit in Rails), and caching.
Profile first
.bm { || x.report() { expensive_method } }
