-
-
Save lukemelia/83377 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require "benchmark" | |
x = 10_000 | |
first_id = Sport.first.id | |
key = "Sport:#{first_id}" | |
Sport.set key, Sport.find(first_id) # prime cache | |
Benchmark.bm(20) do |b| | |
b.report "Sport.get" do | |
x.times do | |
Sport.get key | |
end | |
end | |
end | |
# weplay1 user system total real | |
# Sport.get 17.420000 0.350000 17.770000 ( 24.056716) | |
# | |
# weplay2 user system total real | |
# Sport.get 18.440000 0.490000 18.930000 ( 23.156452) | |
# | |
# weplay3 user system total real | |
# Sport.get 19.640000 0.540000 20.180000 ( 25.612381) | |
# | |
# weplay4 user system total real | |
# Sport.get 18.420000 0.470000 18.890000 ( 28.232393) | |
# | |
# weplay5 user system total real | |
# Sport.get 19.220000 0.490000 19.710000 ( 25.920724) | |
# | |
# weplay6 user system total real | |
# Sport.get 16.710000 0.480000 17.190000 ( 41.580876) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment