Commit 14075671bc2345cd49af0ef1304feec7c7ad3eff
1 parent
662a6f42
Exists in
master
and in
18 other branches
Better benchmark script [skip ci]
Showing
1 changed file
with
6 additions
and
7 deletions
Show diff stats
benchmark/benchmark.rb
@@ -6,7 +6,7 @@ require "active_support/notifications" | @@ -6,7 +6,7 @@ require "active_support/notifications" | ||
6 | 6 | ||
7 | ActiveSupport::Notifications.subscribe "request.searchkick" do |*args| | 7 | ActiveSupport::Notifications.subscribe "request.searchkick" do |*args| |
8 | event = ActiveSupport::Notifications::Event.new(*args) | 8 | event = ActiveSupport::Notifications::Event.new(*args) |
9 | - p event.duration | 9 | + p event.duration.round |
10 | end | 10 | end |
11 | 11 | ||
12 | ActiveJob::Base.queue_adapter = :sidekiq | 12 | ActiveJob::Base.queue_adapter = :sidekiq |
@@ -33,7 +33,7 @@ class Product < ActiveRecord::Base | @@ -33,7 +33,7 @@ class Product < ActiveRecord::Base | ||
33 | end | 33 | end |
34 | end | 34 | end |
35 | 35 | ||
36 | -total_docs = 10000 | 36 | +# total_docs = 100000 |
37 | 37 | ||
38 | # ActiveRecord::Migration.create_table :products, force: :cascade do |t| | 38 | # ActiveRecord::Migration.create_table :products, force: :cascade do |t| |
39 | # t.string :name | 39 | # t.string :name |
@@ -43,7 +43,7 @@ total_docs = 10000 | @@ -43,7 +43,7 @@ total_docs = 10000 | ||
43 | 43 | ||
44 | # Product.import ["name", "color", "store_id"], total_docs.times.map { |i| ["Product #{i}", ["red", "blue"].sample, rand(10)] } | 44 | # Product.import ["name", "color", "store_id"], total_docs.times.map { |i| ["Product #{i}", ["red", "blue"].sample, rand(10)] } |
45 | 45 | ||
46 | -puts "Imported" | 46 | +# puts "Imported" |
47 | 47 | ||
48 | result = nil | 48 | result = nil |
49 | report = nil | 49 | report = nil |
@@ -80,10 +80,9 @@ time = | @@ -80,10 +80,9 @@ time = | ||
80 | # end | 80 | # end |
81 | end | 81 | end |
82 | 82 | ||
83 | -p GetProcessMem.new.mb - start_mem | ||
84 | - | ||
85 | -puts time.round(1) | ||
86 | - | 83 | +puts |
84 | +puts "Memory: #{(GetProcessMem.new.mb - start_mem).round(1)}mb" | ||
85 | +puts "Time: #{time.round(1)}s" | ||
87 | 86 | ||
88 | if result | 87 | if result |
89 | printer = RubyProf::GraphPrinter.new(result) | 88 | printer = RubyProf::GraphPrinter.new(result) |