I have 1500 small objects to render for a webservice inside a rails 4 application. I use json as format with jbuilder for templates. I already changed the json engine to oj in the app initializer:
require 'oj_mimic_json'
#MultiJson.use :yajl
Oj.mimic_JSON
# jbuilder json templates
Jbuilder.key_format camelize: :lower
a single rendered json object looks like this:
center: {lat: 45.962153536249, lon: 7.68207088549831}
lat: 45.962153536249
lon: 7.68207088549831
n: "Zermatt-Cervinia"
st: 80
sy: 0
Rendered json_partials/_snow_in_resort.json.jbuilder (0.5ms)
Rendered json_partials/_snow_in_resort.json.jbuilder (0.5ms)
....
Rendered resorts/find.json.jbuilder (4213.4ms)
Completed 200 OK in 4351ms (Views: 3924.3ms | ActiveRecord: 306.8ms | Solr: 0.0ms)
But still I need 150 ms for 101 kb on my localhost which is way too slow for the task I want to accomplish on the UI. What do I have to do to speed up here? Which things should I check? I appreciate help. Best, Philip
update
I optimized my active record queries down to ActiveRecord: 77.8ms , nevertheless the view rendering is still too slow