We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5b12238 commit d0341f7Copy full SHA for d0341f7
benchmarks/allocations/helper.rb
@@ -2,7 +2,7 @@
2
require 'rspec/core'
3
require 'allocation_stats'
4
5
-def benchmark_allocations(burn: 1)
+def benchmark_allocations(burn: 1, min_allocations: 0)
6
stats = AllocationStats.new(burn: burn).trace do
7
yield
8
end
@@ -13,5 +13,11 @@ def benchmark_allocations(burn: 1)
13
[:class_plus]
14
15
16
- puts stats.allocations(alias_paths: true).group_by(*columns).from_pwd.sort_by_size.to_text
+ results = stats.allocations(alias_paths: true).group_by(*columns).from_pwd.sort_by_size.to_text
17
+ filtered = results.split("\n").select do |line|
18
+ count = line[/\s+(\d+)\z/, 1]
19
+ count.nil? || Integer(count) >= min_allocations
20
+ end.join("\n")
21
+
22
+ puts filtered
23
0 commit comments