summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-26 03:25:15 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-26 03:25:15 +0000
commitfbf531c4a249e75260e80ed767114b02e0a1e985 (patch)
treee4d7d74812f89b89bff865595de72c3148552da9 /benchmark
parent6d597718cf45aff0dd25ee7c7e8bd8e158ac0268 (diff)
downloadbundler-fbf531c4a249e75260e80ed767114b02e0a1e985.tar.gz
* vm.c (frame_info_to_str): add `break'.
* vm.c (backtrace_object): remove lev and n parameter. backtrace_object always returns all of backtrace information. * vm.c (rb_backtrace_to_str_ary): fix to use backtrace_object(). This change improve performance of caller(lev, n). * benchmark/bm_vm3_backtrace.rb: added to check above improvement. FYI: measurement on my laptop, 1.9.3p229 needs 5.125 sec, and current trunk only needs 0.299sec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/bm_vm3_backtrace.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/benchmark/bm_vm3_backtrace.rb b/benchmark/bm_vm3_backtrace.rb
new file mode 100644
index 0000000000..0fbf73e1ca
--- /dev/null
+++ b/benchmark/bm_vm3_backtrace.rb
@@ -0,0 +1,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