Skip to content

Instantly share code, notes, and snippets.

Created September 28, 2012 11:42
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lest/a012d50e817373c08f79 to your computer and use it in GitHub Desktop.
require File.expand_path('../../config/environment', __FILE__)
require 'benchmark'
statuses = TruckStatus.order(:id).limit(10_000)
MultiJson.engine = :json_gem do |x| 'default ' do
end 'attrs ' do
statuses.to_json methods: [:latitude, :longitude, :timestamp, :virtual_odometer]
end 'select ' do[:latitude, :longitude, :timestamp, :virtual_odometer]).to_json methods: [:latitude, :longitude, :timestamp, :virtual_odometer]
end 'lightning' do
end 'json ' do
JSON.dump statuses.lightning
end 'yajl ' do
Yajl.dump statuses.lightning
end 'oj ' do
Oj.dump statuses.lightning, mode: :compat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment