Skip to content

Commit 30bb3f3

Browse files
authored
Merge pull request #62 from jhawthorn/stack_table
Expose StackTable to Ruby
2 parents 521d164 + 346a158 commit 30bb3f3

11 files changed

+648
-157
lines changed

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ gemspec
88
gem "rake", "~> 13.0"
99

1010
gem "rake-compiler"
11+
gem "benchmark-ips"
1112

1213
gem "minitest", "~> 5.0"

examples/measure_overhead.rb

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
require "benchmark/ips"
2+
require "vernier"
3+
4+
def compare(**options, &block)
5+
block.call
6+
7+
Benchmark.ips do |x|
8+
x.report "no profiler" do |n|
9+
n.times do
10+
block.call
11+
end
12+
end
13+
14+
x.report "vernier" do |n|
15+
Vernier.profile(**options) do
16+
n.times do
17+
block.call
18+
end
19+
end
20+
end
21+
22+
x.compare!
23+
end
24+
end
25+
26+
compare do
27+
i = 0
28+
while i < 10_000
29+
i += 1
30+
end
31+
end
32+
33+
compare(allocation_sample_rate: 1000) do
34+
Object.new
35+
end
36+
37+
compare(allocation_sample_rate: 1) do
38+
Object.new
39+
end

0 commit comments

Comments
 (0)