Status Memorandum

Today was another great day working on improving Rails. What happened today:

I made my first commits to Rails.

The commits remove the use of method_missing in respond_to. Effectively, when you did respond_to {|format| format.html }, the format object was a Responder object that collected up the mime types you specified and then followed your instructions. However, the html method was not defined on Responder. Instead, Responder relied on method_missing to determine, on the fly, whether html was a valid mime type.

The fix was to generate methods for all known mime types in advance. In addition, when method_missing is triggered and a valid mime type is detected, Rails now generates a method on the fly (so at maximum single method_missing will be called for a particular method). The main win here is that since the method is generated, it's not longer necessary to check whether the mime exists every time. If you get to the format.html method, that's evidence that the mime exists, since it cannot otherwise be generated.

The upside: 8% full-stack speed-boost on both MRI and JRuby for a simple case (bringing the full-stack overhead when using respond_to down from 2.5ms to 2.3ms). It may not seem like a lot, but 0.2ms here, 0.2ms there, and pretty soon you're talking big... amounts of time?

I did a lot of benchmarking on BlockAwareEnhancer. It turns out that for JRuby, the < %= form_for %>...< % end =%> syntax can bring down a page heavy with block helpers (1,000 block helpers to be precise) down from 30ms to 8ms. In MRI, the same technique brings the total time from 80ms to 65ms. (yes, that is a shockingly good result for JRuby... seems like there are very common, expensive operations that JRuby kicks butt on).

Carl is working hard on making the router super-easy to hook into with any front-end DSL. This will help us easily maintain backward compatibility with current Merb syntax, while giving us the ability to give Rails all the new features of the Merb router with a familiar syntax.

Michael (antares) continues his work on analyzing parts of Extlib that should go in ActiveSupport, comparing the compatibility of the modules, and bringing in new features (LazySet and DeferredModule come to mind). The idea is to make it easier to opt in to small parts of ActiveSupport with the ability to clearly know what will get pulled in as a result.