barrelage/jsonite — pull request #2 by kainosnoema (2013-11-22 04:42:55+00:00)
Title: Performance: add benchmark spec, Jsonite#present method, skip #as_json by default

`ActiveSupport#as_json` turns out to be really expensive, so calling it every time we presented an object added up to a significant amount of CPU time. Most often the JSON serializer will call `as_json` itself, so we don't have to. If however the presenter is passed to the serializer directly, it does have an `as_json` implementation that will do the right thing.

This improves performance by more than 200%. See both commits to see the progress here.

This also pushes resource collection logic (arrays and relations) into the presenter instance itself, so something like `Presenter.new(ary)` will now actually work as expected.