I felt my application slow yesterday and profiled it. RJS is very useful, but it seems to be slow. Thanks to Charlies's ruby-prof (it doesn't belongs to me any more and has fascinating call graph support), I found the bottleneck. It was Object#to_json. The original code is here: define_encoder String do |string| returning value = '"' do string.each_char do |char| value << case when char == "\010":