TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Benchmarking JSON Generation in Ruby

23 pointsby bretthopperalmost 11 years ago

4 comments

rb2k_almost 11 years ago
If you want json to be fast in Ruby, chances are you might want to look at <a href="https://github.com/ohler55/oj" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ohler55&#x2F;oj</a><p>Not sure how easy it is to jam oj into either of these two serializers though.<p>EDIT: rabl seems to support it according to the webpage
评论 #7791225 未加载
评论 #7792182 未加载
rubyn00biealmost 11 years ago
I&#x27;ve had the exact same experience. Rabl is horribly slow in template generation...<p>Also, FWIW-- older versions of AMS, with caching, are a total crapshoot due to marshal dumping the objects into the cache and re-serializing them to JSON each time. Much better to cache the response itself instead of the objects making up the response.<p>Granted the caching feature was yanked out of AMS, but pretty painful for those of us that actually tried using it. Carrierwave + AMS caching = Problemzilla<p>At this point, we too have had Rabl, AMS, and Representers and the best one of the lot-- by far, for our use cases has been: Roar. <a href="https://github.com/apotonick/roar-rails" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;apotonick&#x2F;roar-rails</a><p>Plus, it&#x27;s the only system which will de-serialize the data using the representer. Boom-shaka-laka.
steveklabnikalmost 11 years ago
AMS maintainer (though admittedly doing a poor job of it lately :&#x2F;) here.<p>Which version were you benchmarking? The in-alpha 0.9 was a total re-write, so it&#x27;d be interesting to see how it compares.<p>Also, AMS has a caching feature (that is being re-written, too) that&#x27;d make for an interesting benchmark.
评论 #7792150 未加载
评论 #7791229 未加载
shadelessalmost 11 years ago
No mention of jbuilder? When I looked at the popularity of json generators it seemed to be the most popular one, but now it occurred to me that it may be because it&#x27;s included by default in Rails.
评论 #7791501 未加载