Commit 32e008178497ae33e7cfcdd7bc34a95e9187cf12
1 parent
fdfbf371
Exists in
master
and in
20 other branches
More benchmark gems [skip ci]
Showing
2 changed files
with
13 additions
and
4 deletions
Show diff stats
benchmark/Gemfile
benchmark/benchmark.rb
... | ... | @@ -30,13 +30,16 @@ Product.import ["name", "color", "store_id"], 20000.times.map { |i| ["Product #{ |
30 | 30 | puts "Imported" |
31 | 31 | |
32 | 32 | result = nil |
33 | +report = nil | |
34 | +stats = nil | |
33 | 35 | |
34 | 36 | # p GetProcessMem.new.mb |
35 | 37 | |
36 | 38 | time = |
37 | 39 | Benchmark.realtime do |
38 | 40 | # result = RubyProf.profile do |
39 | - # result = AllocationStats.trace do | |
41 | + # report = MemoryProfiler.report do | |
42 | + # stats = AllocationStats.trace do | |
40 | 43 | Product.reindex |
41 | 44 | # end |
42 | 45 | end |
... | ... | @@ -46,11 +49,15 @@ time = |
46 | 49 | puts time.round(1) |
47 | 50 | puts Product.searchkick_index.total_docs |
48 | 51 | |
49 | -# puts result.allocations(alias_paths: true).group_by(:sourcefile, :class).to_text | |
50 | - | |
51 | 52 | if result |
52 | 53 | printer = RubyProf::GraphPrinter.new(result) |
53 | 54 | printer.print(STDOUT, min_percent: 5) |
54 | 55 | end |
55 | 56 | |
56 | -# puts Product.count | |
57 | +if report | |
58 | + puts report.pretty_print | |
59 | +end | |
60 | + | |
61 | +if stats | |
62 | + puts result.allocations(alias_paths: true).group_by(:sourcefile, :class).to_text | |
63 | +end | ... | ... |