diff options
| author | mo khan <mo.khan@gmail.com> | 2020-05-12 16:47:28 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-05-12 16:47:28 -0600 |
| commit | a32acb798b8fc5e3349fc49118f05b060a48ae43 (patch) | |
| tree | 0778249d938862157fc89dc2c886181c6bca776c /spec/integration/core | |
| parent | 09c22f11996144919d016223c07b31bcf1973187 (diff) | |
play with pointers
Diffstat (limited to 'spec/integration/core')
| -rw-r--r-- | spec/integration/core/cache_spec.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/spec/integration/core/cache_spec.rb b/spec/integration/core/cache_spec.rb index 6161c6c..e040bb5 100644 --- a/spec/integration/core/cache_spec.rb +++ b/spec/integration/core/cache_spec.rb @@ -162,28 +162,31 @@ RSpec.describe Spandx::Core::Cache do expect { subject.take(100_000).count }.to perform_under(0.1).sample(10) end + it 'profiles each' do + with_profiler do + subject.take(100_000).count + end + end + xit 'profiles each option' do 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 + x.report('fastest-csv') do datafile.open_file(mode: 'rb') do |io| while (x = io.gets) ::CsvParser.parse_line(x) end end end - x.report('manual-gets-c-ext') do + x.report('spandx') 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) } } } x.compare! end |
