ruby-changes:58487
From: Lourens <ko1@a...>
Date: Tue, 29 Oct 2019 11:41:44 +0900 (JST)
Subject: [ruby-changes:58487] fecaa6e946 (master): Let the backtrace array constructed in backtrace_collect be initialized with the size already given
https://git.ruby-lang.org/ruby.git/commit/?id=fecaa6e946 From fecaa6e946fc87df28682c96fea67c1535825cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lourens=20Naud=C3=A9?= <lourens@b...> Date: Tue, 22 Oct 2019 00:03:05 +0100 Subject: Let the backtrace array constructed in backtrace_collect be initialized with the size already given diff --git a/vm_backtrace.c b/vm_backtrace.c index b04f6da..5b79e3d 100644 --- a/vm_backtrace.c +++ b/vm_backtrace.c @@ -578,7 +578,7 @@ backtrace_collect(rb_backtrace_t *bt, long lev, long n, VALUE (*func)(rb_backtra https://github.com/ruby/ruby/blob/trunk/vm_backtrace.c#L578 rb_bug("backtrace_collect: unreachable"); } - btary = rb_ary_new(); + btary = rb_ary_new2(n); for (i=0; i+lev<bt->backtrace_size && i<n; i++) { rb_backtrace_location_t *loc = &bt->backtrace[bt->backtrace_size - 1 - (lev+i)]; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/