diff --git a/benchmark/Gemfile b/benchmark/Gemfile index 9d55360..36ec910 100644 --- a/benchmark/Gemfile +++ b/benchmark/Gemfile @@ -6,5 +6,7 @@ gemspec path: "../" gem "sqlite3" gem "activerecord", "~> 5.0.0" gem "activerecord-import" -gem "ruby-prof" gem "oj" +gem "ruby-prof" +gem "allocation_stats" +gem "get_process_mem" diff --git a/benchmark/benchmark.rb b/benchmark/benchmark.rb index 04dc5cf..15284ed 100644 --- a/benchmark/benchmark.rb +++ b/benchmark/benchmark.rb @@ -17,22 +17,29 @@ class Product < ActiveRecord::Base searchkick batch_size: 100 end -Product.import ["name", "color", "store_id"], 100000.times.map { |i| ["Product #{i}", ["red", "blue"].sample, rand(10)] } +Product.import ["name", "color", "store_id"], 10000.times.map { |i| ["Product #{i}", ["red", "blue"].sample, rand(10)] } puts "Imported" result = nil +p GetProcessMem.new.mb + time = Benchmark.realtime do # result = RubyProf.profile do - Product.reindex(refresh_interval: "30s") + # result = AllocationStats.trace do + Product.reindex # end end +p GetProcessMem.new.mb + puts time.round(1) puts Product.searchkick_index.total_docs +# puts result.allocations(alias_paths: true).group_by(:sourcefile, :class).to_text + # printer = RubyProf::GraphPrinter.new(result) # printer.print(STDOUT, min_percent: 2) -- libgit2 0.21.0