I have done a fair amount of performance optimization work in .NET/C#, so I was curious as to what kind of optimizations are involved in Ruby.
One of the optimization was this:
https://github.com/SamSaffron/rails/commit/9aa2b2d7bf52c0f39...
Three lessons:
1. Always use profiler to identify code bottlenecks. I don't think I would have ever guessed that the string literal is costing memory allocations causing performance issues.
2. I find it sad that this kind of optimization is required in 2015. In any statically typed language, this would be completely unnecessary.
3. Performance optimization makes code less readable. I think it would make sense to add comment explaining why constant ID was declared.
Here's another:
https://github.com/SamSaffron/rails/commit/a668b09ee387bf241...
Same story.