Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 20th, 2012  |  syntax: None  |  size: 0.29 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Very slow running as_json (Mongoid   Sinatra)
  2. get '/games' do
  3.   content_type :text
  4.   obj = nil
  5.   t1 = Benchmark.measure { @games = filtered_games.entries }
  6.   t2 = Benchmark.measure { obj = @games.as_json }
  7.   t3 = Benchmark.measure { obj.to_json }
  8.   "Query: #{t1}nTo Object: #{t2}nJSON: #{t3}"
  9. end