summaryrefslogtreecommitdiff
path: root/bin/csv-benchmark
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-05-20 00:12:40 -0600
committermo khan <mo.khan@gmail.com>2020-05-20 00:12:40 -0600
commitcef405d5e9bcb54ef8c153d00d73e7dd47fe7557 (patch)
tree79fc1e5cb7a24a4e1832ade577eb5efde1de2638 /bin/csv-benchmark
parent2d531994728ae904c4f2e871ce4ea07874ca0f25 (diff)
Add spandx to csv benchmark
Diffstat (limited to 'bin/csv-benchmark')
-rwxr-xr-xbin/csv-benchmark15
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/csv-benchmark b/bin/csv-benchmark
index dc0bb80..af09a10 100755
--- a/bin/csv-benchmark
+++ b/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