-
-
Save anonymous/f6c6c7b2e215fdbc194c 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
require 'benchmark' | |
queue=[1]*1_000_000 | |
Benchmark.measure {10_000.times {stack.unshift stack.pop}} | |
#=> 21.953000 0.000000 21.953000 ( 21.953125) | |
Benchmark.measure {10_000.times {stack.push stack.shift}} | |
#=> 118.000000 37.547000 155.547000 (155.859375) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment