gazay/gon — pull request #132 by jackquack (2014-05-26 01:34:52+00:00)
Title: Feature: Improve performance by about 10x by adding dependency of Oj

I noticed that a call to include_gon was costing in the range of 100ms+ for me, so I got curious.

It turns out, most of the performance penalty is caused by using the default ruby implementation of JSON serialization. In my own work, I've made us of the Oj library to improve performance, so I gave that a try. That call that used to take 100ms+, now takes <10ms.

I ran the spec before and after, and curiously 1 of the 2 previously failing specs "Gon#include_gon outputs correct js with a script string" is now passing...

I know it's an extra dependency, but it seems worth it in cases where there is nothing in standard ruby that can deliver the same performance improvement.