summaryrefslogtreecommitdiff
path: root/benchmark/array_shift.yml
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/array_shift.yml')
-rw-r--r--benchmark/array_shift.yml17
1 files changed, 17 insertions, 0 deletions
diff --git a/benchmark/array_shift.yml b/benchmark/array_shift.yml
new file mode 100644
index 0000000..713c542
--- /dev/null
+++ b/benchmark/array_shift.yml
@@ -0,0 +1,17 @@
+benchmark:
+ array_shift: |
+ require 'benchmark'
+
+ Benchmark.bm do |x|
+ [10_000,1_000_000,100_000_000].each do |n|
+ ary = Array.new(n,0)
+ GC.start
+ x.report("#{n}:shift"){ ary.shift }
+ (0..4).each do |i|
+ ary = Array.new(n,0)
+ GC.start
+ x.report("#{n}:shift(#{i})"){ ary.shift(i) }
+ end
+ end
+ end
+loop_count: 1