Benchmark.ips do |x|
x.time = 10
x.report("Special#first") do
Special.first
end;1
x.report("Special#where") do
Special.where(id: 255)
end;1
x.report("Special#find") do
Special.find(500)
end;1
x.report("Special#find_by_slug") do
Special.find_by_slug("aced-31090cae-0a26-454b-981f-c4c9209a8408")
end;1
end;1
10,000 Specials
#<Special:0x007fb43521ef80
id: 1,
name: "abc",
body: "",
featured: false,
on_hold: false,
created_at: Thu, 01 Jan 2015 04:20:12 UTC +00:00,
updated_at: Thu, 01 Jan 2015 07:10:42 UTC +00:00,
deleted_at: nil>
- Special#first - 2.0k (± 7.6%) i/s
- Special#where - 27.7k (±12.3%) i/s
- Special#find - 3.6k (± 9.1%) i/s
- Special#find_by_slug - 542.4 (± 4.2%) i/s
- Special#first - 1.5k (± 6.9%) i/s
- Special#where - 9.4k (± 9.7%) i/s
- Special#find - 1.7k (± 7.6%) i/s
- Special#find_by_slug - 442.7 (± 5.0%) i/s
- Special#first - 1.8k (± 7.3%) i/s
- Special#where - 18.5k (±14.2%) i/s
- Special#find - 2.0k (± 8.6%) i/s
- Special#find_by_slug - 464.0 (± 4.3%) i/s