Created
April 25, 2014 03:00
-
-
Save mharris717/11276545 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load "lib/baseball_lottery.rb" | |
MGC.connect! :production | |
def big_hash | |
res = {} | |
(1..100).each do |i| | |
res[i] = {} | |
50.times do | |
res[i][rand(100000000000)] = rand(1000000000000).to_s | |
end | |
end | |
res | |
end | |
class Payload | |
include Mongoid::Document | |
field :num, type: Integer | |
store_in session: "baseball_lottery" | |
end | |
class PayloadBig | |
include Mongoid::Document | |
field :nums, type: Hash | |
store_in session: "baseball_lottery" | |
end | |
Payload.delete_all | |
(1..5000).each_print_progress(name: "single number") do |i| | |
Payload.create! num: i | |
end | |
(1..500).each_print_progress(name: "big hash") do |i| | |
PayloadBig.create! nums: big_hash | |
end | |
str = <<EOF | |
local dev single: 1797/sec | |
big hash: 47/sec | |
num prod single: 53/sec | |
big prod: 0.9/sec | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment