Sha256: bfe279c1fc79dac23734a923b2d431185fde6d50e19a1904b238764632d4c556

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'


describe "benchmark for strategies" do
  let(:count_of_lines) { 100000 }

  describe "strategy contains with substring search" do
    let(:keywords) { %w{ab c d} }
    let(:data) { generate_testdata(keywords: keywords, count_of_data: count_of_lines) }

    it "is fast", :bm => true do
      comparator = Strategies::ContainsWithSubstringSearch.add_check(data,keywords)
      time_taken = Benchmark.realtime { comparator.success? }
      expect(time_taken).to be < 1
    end
  end

  describe "strategy contains" do
    let(:keywords) { %w{a c d} }
    let(:data) { generate_testdata(keywords: keywords, count_of_data: count_of_lines) }

    it "is fast", :bm => true do
      comparator = Strategies::Contains.add_check(data,keywords)
      time_taken = Benchmark.realtime { comparator.success? }
      expect(time_taken).to be < 1
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
the_array_comparator-0.2.0 spec/benchmark/benchmark_spec.rb
the_array_comparator-0.1.1 spec/benchmark/benchmark_spec.rb