Skip to content

Commit

Permalink
Improve performance for Combine.combine
Browse files Browse the repository at this point in the history
Create less intermediate objects.
  • Loading branch information
splattael committed Jan 7, 2025
1 parent 1e36da1 commit bc059fc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/simplecov/combine/lines_combiner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ module LinesCombiner
module_function

def combine(coverage_a, coverage_b)
coverage_a
.zip(coverage_b)
.map do |coverage_a_val, coverage_b_val|
merge_line_coverage(coverage_a_val, coverage_b_val)
end
coverage_a.map.with_index do |coverage_a_val, index|
merge_line_coverage(coverage_a_val, coverage_b[index])
end
end

# Return depends on coverage in a specific line
Expand Down

0 comments on commit bc059fc

Please sign in to comment.