benchmarks/rufus_decision.rb in csv_decision-0.0.9 vs benchmarks/rufus_decision.rb in csv_decision-0.1.0

- old
+ new

@@ -1,12 +1,10 @@ # frozen_string_literal: true require 'benchmark/ips' require 'benchmark/memory' require 'rufus/decision' -require 'ice_nine' -require 'ice_nine/core_ext/object' require_relative '../lib/csv_decision' SPEC_DATA_VALID ||= File.join(CSVDecision.root, 'spec', 'data', 'valid') @@ -28,11 +26,11 @@ input: { 'age' => '40', 'trait' => 'cheerful' }, # Expected results for first_match and accumulate first_match: { 'salesperson' => 'Swanson' }, accumulate: { 'salesperson' => %w[Swanson Korolev] } } -].deep_freeze +].freeze tag_width = 70 puts "" puts "Benchmarking Decisions per Second" @@ -59,11 +57,11 @@ input_symbolized = input.symbolize_keys # Test expected results expected = first_match ? test[:first_match] : test[:accumulate] - result = rufus_table.transform!(input) + result = rufus_table.transform(input) unless result.slice(*expected.keys).eql?(expected) raise "Rufus expected results check failed for test: #{name}" end @@ -79,10 +77,10 @@ count.times { csv_table.decide!(input_symbolized) } end GC.start x.report("Rufus decision (first_match: #{first_match}) - #{name}: ") do |count| - count.times { rufus_table.transform!(input) } + count.times { rufus_table.transform(input) } end x.compare! end end