Commit cef405d
Changed files (1)
bin
bin/csv-benchmark
@@ -9,21 +9,24 @@ gemfile do
gem 'benchmark-ips', '~> 2.8'
gem 'fastcsv', '~> 0.0'
gem 'fastest-csv'
+ gem 'spandx'
end
require 'benchmark/ips'
require 'csv'
require 'fastcsv'
require 'fastest-csv'
+require 'spandx'
csv = '"spandx","0.0.0","MIT"'
Benchmark.ips do |x|
- x.report('CSV.parse') { CSV.parse(csv)[0] }
- x.report('csv.split') { csv.split(',', 3) }
- x.report('csv.split-with-slice') { csv.chomp.split(',', 3).slice(1...-1) }
- x.report('csv.regex') { csv.scan(/"(\S+)","*(\d+.\d+.\d+)","(\S+)"/)[0] }
- x.report('csv.fastcsv') { FastCSV.raw_parse(csv) { |y| y } }
- x.report('csv.fastestcsv') { FastestCSV.parse_line(csv) }
+ x.report('csv') { CSV.parse(csv)[0] }
+ x.report('fastcsv') { FastCSV.raw_parse(csv) { |y| y } }
+ x.report('fastestcsv') { FastestCSV.parse_line(csv) }
+ x.report('regex') { csv.scan(/"(\S+)","*(\d+.\d+.\d+)","(\S+)"/)[0] }
+ x.report('spandx') { Spandx::Core::CsvParser.parse(csv) }
+ x.report('split') { csv.split(',', 3) }
+ x.report('split-with-slice') { csv.chomp.split(',', 3).slice(1...-1) }
x.compare!
end