Created
January 11, 2017 04:07
-
-
Save sonalkr132/7b1c37f819b80665d6ea0f188c88ac97 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/ips' | |
Benchmark.ips do |x| | |
x.report("update_gem_downloads") do | |
updates_by_gem = {31141=>81, 55109=>36, 75586=>72, 27046=>72, 78002=>24, 80114=>62, 88344=>43, 91314=>40, 112811=>78, 74471=>3, 37936=>83, 85831=>32, 19193=>73, 106461=>26, 92080=>84, 23033=>23, 28444=>32, 69808=>25, 111504=>30, 114083=>87} | |
GemDownload.update_gem_downloads(updates_by_gem) | |
end | |
x.report("update_gem_downloads_old") do | |
updates_by_gem = {45908=>91, 80612=>46, 59193=>29, 72913=>65, 25443=>82, 59819=>60, 85201=>42, 42041=>67, 51804=>34, 43622=>86, 64017=>52, 41448=>6, 108872=>24, 28863=>15, 54962=>51, 74408=>71, 70542=>9, 27849=>5, 97372=>0, 34692=>55} | |
GemDownload.update_gem_downloads_old(updates_by_gem) | |
end | |
x.compare! | |
end |
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
Warming up -------------------------------------- | |
update_gem_downloads 1.000 i/100ms | |
update_gem_downloads_old | |
1.000 i/100ms | |
Calculating ------------------------------------- | |
update_gem_downloads 2.329 (± 0.0%) i/s - 12.000 in 5.163686s | |
update_gem_downloads_old | |
2.255 (± 0.0%) i/s - 12.000 in 5.382416s | |
Comparison: | |
update_gem_downloads: 2.3 i/s | |
update_gem_downloads_old: 2.3 i/s - 1.03x slower |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment