summaryrefslogtreecommitdiff
path: root/benchmark/bm_vm3_backtrace.rb
blob: 0fbf73e1cae0d2c16c03a1f6f2f98f960c369b80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# get last backtrace

begin
  caller(0, 0)
rescue ArgumentError
  alias caller_orig caller
  def caller lev, n
    caller_orig(lev)[0..n]
  end
end

def rec n
  if n < 0
    100_000.times{
      caller(0, 1)
    }
  else
    rec(n-1)
  end
end

rec 50