Striking a Balance Between Convention and Performance

Citation: Mark A. McBride (markmcb), Striking a Balance Between Convention and Performance, OmniNerd.com, 02 January 2009, accessed on 20 May 2013 from http://www.omninerd.com/articles/Striking_a_Balance_Between_Convention_and_Performance
Tags: code, rails, and performance

I recently had some correspondence with one of the other OmniNerd developers concerning the trade off between always following the conventions of our chosen framework, Ruby on Rails, and writing custom low-level code to specifically avoid Rails features that are inefficient in specific scenarios.

The baseline argument for convention is simple: if you stick with convention you help ensure future support as the framework matures, and you allow anyone who understands the framework to easily understand your application. Likewise, the baseline argument for customization is simple too: you can save yourself a lot of money that will be spent on hardware by writing code that most efficiently tackles your biggest bottlenecks.

Academic arguments are great and all, but I’m wondering more about the practicality of how one approaches such a problem with limited resources. Take OmniNerd for example. It’s not the full time job of any of it’s developers. Right now we’re 100% following Rails conventions, but as our traffic grows and we implement more complex code and queries, some conventional approaches are putting a decent load on our hardware. So we have two basic options: pay for bigger hardware, or spend more time writing/maintaining custom code that allows us to live on our existing hardware.

I’m curious if anyone out there has any experience with this sort of thing. Are there any natural “triggers” you see for when to spend the time and effort on customized optimization versus simply throwing money and more powerful hardware? Any lessons learned from actual dealings with this sort of thing?