diff options
Diffstat (limited to 'support/benchmarks/load_allocations.rb')
-rw-r--r-- | support/benchmarks/load_allocations.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/support/benchmarks/load_allocations.rb b/support/benchmarks/load_allocations.rb index b0f9768..39e1f3a 100644 --- a/support/benchmarks/load_allocations.rb +++ b/support/benchmarks/load_allocations.rb @@ -24,11 +24,10 @@ module Benchmarks @mime_types_only = !!mime_types_only @top_x = top_x - if @top_x - @top_x = top_x.to_i - @top_x = 10 if @top_x <= 0 - end + return unless @top_x + @top_x = top_x.to_i + @top_x = 10 if @top_x <= 0 end def report @@ -38,6 +37,7 @@ module Benchmarks end private + def report_top_x table = @allocations.sort_by { |_, v| v.first }.reverse.first(@top_x) table.map! { |(location, allocs)| @@ -58,8 +58,8 @@ module Benchmarks end end - pattern = [ "%%-%ds" ] - pattern << ([ "%% %ds" ] * (max_widths.length - 1)) + pattern = [ '%%-%ds' ] + pattern << ([ '%% %ds' ] * (max_widths.length - 1)) pattern = pattern.join("\t") % max_widths table.each { |row| puts pattern % row } puts |