タグ

ブックマーク / blog.shugo.net (1)

  • to_json too slow

    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":

    sousk
    sousk 2006/07/12
    case-when ではなく正規表現を使うとかいう
  • 1