Sha256: 206bc7910a9a3cccbfbfad1ddd65c16d05bad6e74ac7573cecc24d7cdd5ecbc5

Contents?: true

Size: 522 Bytes

Versions: 6

Compression:

Stored size: 522 Bytes

Contents

$LOAD_PATH.unshift 'lib'
require 'm'
require 'allocation_stats'

def benchmark_allocations(burn: 1)
  stats = AllocationStats.new(burn: burn).trace do
    yield
  end

  columns = if ENV['DETAIL']
              [:sourcefile, :sourceline, :class_plus]
            else
              [:class_plus]
            end

  puts stats.allocations(alias_paths: true).group_by(*columns).sort_by_size.to_text
end

benchmark_allocations do
  10.times do
    M::Runner.new(['test/examples/minitest_5_example_test.rb:19']).run
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
m-1.6.1 test/allocations.rb
m-1.6.0 test/allocations.rb
m-1.5.1 test/allocations.rb
m-1.5.0 test/allocations.rb
m-1.4.2 test/allocations.rb
m-1.4.0 test/allocations.rb