Data-Liberation-Front / csvlint.rb

The gem behind http://csvlint.io
MIT License
283 stars 86 forks source link

Memoize the result of CSV#encode_re #157

Closed jpmckinney closed 8 years ago

jpmckinney commented 8 years ago

stack

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:

stack