Join GitHub today
ActiveSupport::JSON and json gem #1026
I profiled #1025 patch and stumbled upon some very disturbing behavior of activesupport/json.
This code always loads the whole json gem (which, we know, has quite big memory footprint of ~12MB) just to ensure that internal AS implementation wins the monkey patch battle.
I patched my local activesupport stack to not load
What can we do?
Urgh. Good catch. I thought active_support lazy-loads
I stumbled on the behaviour of the
For the moment (in: this weekend), I'd live with the 12mb for the better feature, but you are right: we need to find a bright idea to not needlessly load
Okay, I found what's messing with my gem stack. ActiveSupport is actually not dependent on
Though this issue is not exactly padrino's one, I think the casualty should be addressed in some performance-related chapter of our docs.
That would only delay the problem until some time after bootstrap, so such patterns should generally be avoided if a problem is already known. A different implementation might still be a good idea:
Another option would be to bypass ActiveSupport and use MultiJSON directly, which doesn't monkey-patch and also avoids loading the whole set of things in:
In my opinion, if the