summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/licensed/bundler/fastest-csv.dep.yml33
-rwxr-xr-xbin/csv-benchmark15
2 files changed, 41 insertions, 7 deletions
diff --git a/.github/licensed/bundler/fastest-csv.dep.yml b/.github/licensed/bundler/fastest-csv.dep.yml
new file mode 100644
index 0000000..9f19b1a
--- /dev/null
+++ b/.github/licensed/bundler/fastest-csv.dep.yml
@@ -0,0 +1,33 @@
+---
+name: fastest-csv
+version: 0.0.4
+type: bundler
+summary: Fastest standard CSV parser for MRI Ruby and JRuby
+homepage: https://github.com/brightcode/fastest-csv
+license: mit
+licenses:
+- sources: LICENSE
+ text: |-
+ Copyright (c) 2012 Maarten Oelering
+
+ MIT License
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+notices: []
diff --git a/bin/csv-benchmark b/bin/csv-benchmark
index f7573f2..dc0bb80 100755
--- a/bin/csv-benchmark
+++ b/bin/csv-benchmark
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
require 'bundler/inline'
@@ -15,14 +16,14 @@ require 'csv'
require 'fastcsv'
require 'fastest-csv'
-csv = "\"spandx\",\"0.0.0\",\"MIT\""
+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) { |x| x } }
- x.report("csv.fastestcsv") { FastestCSV.parse_line(csv) }
+ 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.compare!
end