Skip to content

Commit

Permalink
use _
Browse files Browse the repository at this point in the history
  • Loading branch information
sebyx07 committed Aug 10, 2024
1 parent 5ca9d1e commit 0b901ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions spec/iterators/immutable/array/each_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ class Array
end

it 'benchmarks native implementation against original' do
array = (1..1_000_000).to_a
iterations = 100
array = (1..10_000_000).to_a
iterations = 10

puts "Benchmark results (average over #{iterations} iterations):"
Benchmark.bm(20) do |x|
x.report('Original each:') do
iterations.times { array.original_each { |n| n * 2 } }
end
x.report('Native each:') do
x.report('Immutable Native each:') do
iterations.times { array.each { |n| n * 2 } }
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/iterators/immutable/array/each_with_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class Array
puts "Benchmark results (average over #{iterations} iterations):"
Benchmark.bm(25) do |x|
x.report('Original each_with_index:') do
iterations.times { array.original_each_with_index { |item, index| } }
iterations.times { array.original_each_with_index { |_, _| } }
end
x.report('Native each_with_index:') do
iterations.times { array.each_with_index { |item, index| } }
x.report('Immutable Native each_with_index:') do
iterations.times { array.each_with_index { |_, _| } }
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/iterators/mutable/array/each_with_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class Array
puts "Benchmark results (average over #{iterations} iterations):"
Benchmark.bm(25) do |x|
x.report('Original each_with_index:') do
iterations.times { array.original_each_with_index { |item, index| } }
iterations.times { array.original_each_with_index { |_, _| } }
end
x.report('Native each_with_index:') do
iterations.times { array.each_with_index { |item, index| } }
x.report('Mutable Native each_with_index:') do
iterations.times { array.each_with_index { |_, _| } }
end
end
end
Expand Down

0 comments on commit 0b901ba

Please sign in to comment.