Closed jpmckinney closed 8 years ago
Calling CSV.new twice for each line of a CSV is expensive, and the slowest part of that is calling encode_re on the same string thousands of times (this is the biggest bottleneck). This patch memoizes return values and produces the following graph:
CSV.new
encode_re
Calling
CSV.new
twice for each line of a CSV is expensive, and the slowest part of that is callingencode_re
on the same string thousands of times (this is the biggest bottleneck). This patch memoizes return values and produces the following graph: