Sha256: 83f2d295f607854c665e027e0f214b11f2a538b964d4ebb682256d0c510cf809

Contents?: true

Size: 478 Bytes

Versions: 1

Compression:

Stored size: 478 Bytes

Contents

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

def benchmark_allocations burn: 1, &block
  stats = AllocationStats.new(burn: burn).trace(&block)

  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

1 entries across 1 versions & 1 rubygems

Version Path
m-1.6.2 test/allocations.rb