We've used representative (https://github.com/mdub/representative_view and https://github.com/mdub/representative) for this - it used to be a bit slow (esp on 1.8.7), but the latest release did wonders for performance.
On May 24, 4:42 pm, Samuel Richardson <[email protected]> wrote: > Hi List, > > I've been struggling with a particular dynamic bit of JSON rendering that's > fairly slow on my website. A typical render would be: > > Completed 200 OK in *1408ms* (Views: 279.4ms | ActiveRecord: 148.8ms | > Sphinx: 0.0ms) > > The view and ActiveRecord aren't too bad but the total time is awful. Nearly > 1.5 seconds. I thought for a while that it might have been my JSON encoding > so I added the "yajl-ruby" gem to my Gemfile under the assumption that Rails > would pick this up and use it automatically (it uses C bindings instead of > pure Ruby for encoding) but it didn't seem to have an effect. > > I've also bumped my Rails version to 3.0.7, using MySQL in the backend > hoping that later point release might have helped. > > If you want to see the behaviour in action, you can load up: > > http://beta.knowyourgenre.comand have a play flicking backwards and > forwards in the popular genres section down the bottom of the page. You'll > also notice that the unpopular genres section, which has no songs, is quite > a bit faster, so whatever is causing it is related to the number of songs. > > I've dumped out a log of the queries etc used to generate that chunk. For > all I know that could be the problem but I don't think it is due to AR only > report 100ms or so to run. > > www.richardson.co.nz/render.txt > > What I'm after here is what should I be looking at for debugging? JSON > encoding, slow ActiveRecord or something else? > > Samuel Richardsonwww.richardson.co.nz| 0405 472 748 -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
