diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-11 14:19:01 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-11 14:19:01 -0600 |
| commit | 8776ba84032e76578296754d18ab1ac45d940fb1 (patch) | |
| tree | a4980569d15d89440130eba145a43aaa414915c8 /spec/integration/core | |
| parent | 0a79ac869b4446938ce6672322e84702f4d8d5a4 (diff) | |
Build naive csv parser
Diffstat (limited to 'spec/integration/core')
| -rw-r--r-- | spec/integration/core/cache_spec.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/spec/integration/core/cache_spec.rb b/spec/integration/core/cache_spec.rb index a982fde..f57c766 100644 --- a/spec/integration/core/cache_spec.rb +++ b/spec/integration/core/cache_spec.rb @@ -163,7 +163,9 @@ RSpec.describe Spandx::Core::Cache do end xit 'profiles each option' do - datafile = Spandx::Core::DataFile.new('~/.local/share/spandx/rubygems-cache/.index/02/rubygems') + require 'fastest-csv' + + datafile = Spandx::Core::DataFile.new("#{Dir.home}/.local/share/spandx/rubygems-cache/.index/d9/rubygems") Benchmark.ips do |x| x.report('fastest-csv') { FastestCSV.foreach(datafile.absolute_path) { |y| } } x.report('manual-gets') do @@ -173,6 +175,13 @@ RSpec.describe Spandx::Core::Cache do end end end + x.report('manual-gets-c-ext') do + datafile.open_file(mode: 'rb') do |io| + while (x = io.gets) + ::Spandx::Core::CsvParser.parse(x) + end + end + end x.report('manual-eof') { datafile.open_file { |io| FastestCSV.parse_line(io.readline) until io.eof? } } x.report('manual-exception') { datafile.open_file { |io| loop { FastestCSV.parse_line(io.readline) } } } |
