Commit fdfbf3712d21c1203b153dd941c9f5d8f120f857
1 parent
7b13cf2e
Exists in
master
and in
20 other branches
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 +6,7 @@ gemspec path: "../" | ||
6 | gem "sqlite3" | 6 | gem "sqlite3" |
7 | gem "activerecord", "~> 5.0.0" | 7 | gem "activerecord", "~> 5.0.0" |
8 | gem "activerecord-import" | 8 | gem "activerecord-import" |
9 | +gem "typhoeus" | ||
9 | gem "oj" | 10 | gem "oj" |
10 | gem "ruby-prof" | 11 | gem "ruby-prof" |
11 | gem "allocation_stats" | 12 | gem "allocation_stats" |
benchmark/benchmark.rb
@@ -15,9 +15,17 @@ end | @@ -15,9 +15,17 @@ end | ||
15 | 15 | ||
16 | class Product < ActiveRecord::Base | 16 | class Product < ActiveRecord::Base |
17 | searchkick batch_size: 100 | 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 | end | 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 | puts "Imported" | 30 | puts "Imported" |
23 | 31 | ||
@@ -42,7 +50,7 @@ puts Product.searchkick_index.total_docs | @@ -42,7 +50,7 @@ puts Product.searchkick_index.total_docs | ||
42 | 50 | ||
43 | if result | 51 | if result |
44 | printer = RubyProf::GraphPrinter.new(result) | 52 | printer = RubyProf::GraphPrinter.new(result) |
45 | - printer.print(STDOUT, min_percent: 2) | 53 | + printer.print(STDOUT, min_percent: 5) |
46 | end | 54 | end |
47 | 55 | ||
48 | # puts Product.count | 56 | # puts Product.count |