Commit fdfbf3712d21c1203b153dd941c9f5d8f120f857

Authored by Andrew Kane
1 parent 7b13cf2e

Updated benchmarking [skip ci]

Showing 2 changed files with 11 additions and 2 deletions   Show diff stats
benchmark/Gemfile
... ... @@ -6,6 +6,7 @@ gemspec path: "../"
6 6 gem "sqlite3"
7 7 gem "activerecord", "~> 5.0.0"
8 8 gem "activerecord-import"
  9 +gem "typhoeus"
9 10 gem "oj"
10 11 gem "ruby-prof"
11 12 gem "allocation_stats"
... ...
benchmark/benchmark.rb
... ... @@ -15,9 +15,17 @@ end
15 15  
16 16 class Product < ActiveRecord::Base
17 17 searchkick batch_size: 100
  18 +
  19 + def search_data
  20 + {
  21 + name: name,
  22 + color: color,
  23 + store_id: store_id
  24 + }
  25 + end
18 26 end
19 27  
20   -Product.import ["name", "color", "store_id"], 10000.times.map { |i| ["Product #{i}", ["red", "blue"].sample, rand(10)] }
  28 +Product.import ["name", "color", "store_id"], 20000.times.map { |i| ["Product #{i}", ["red", "blue"].sample, rand(10)] }
21 29  
22 30 puts "Imported"
23 31  
... ... @@ -42,7 +50,7 @@ puts Product.searchkick_index.total_docs
42 50  
43 51 if result
44 52 printer = RubyProf::GraphPrinter.new(result)
45   - printer.print(STDOUT, min_percent: 2)
  53 + printer.print(STDOUT, min_percent: 5)
46 54 end
47 55  
48 56 # puts Product.count
... ...