ruby-changes:57896
From: Koichi <ko1@a...>
Date: Wed, 25 Sep 2019 17:03:40 +0900 (JST)
Subject: [ruby-changes:57896] 3deeb3fd91 (master): introduce `obj_ary_extracapa`.
https://git.ruby-lang.org/ruby.git/commit/?id=3deeb3fd91 From 3deeb3fd914bc5604e84e7a41ec2b5193a560479 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Wed, 25 Sep 2019 16:55:54 +0900 Subject: introduce `obj_ary_extracapa`. Introduce a new debug counter `obj_ary_extracapa` which counts arrays which are `len < capa`. diff --git a/array.c b/array.c index 68f9321..7b086f4 100644 --- a/array.c +++ b/array.c @@ -786,6 +786,8 @@ void https://github.com/ruby/ruby/blob/trunk/array.c#L786 rb_ary_free(VALUE ary) { if (ARY_OWNS_HEAP_P(ary)) { + (void)RB_DEBUG_COUNTER_INC_IF(obj_ary_extracapa, ARY_HEAP_CAPA(ary) > RARRAY_LEN(ary)); + if (RARRAY_TRANSIENT_P(ary)) { RB_DEBUG_COUNTER_INC(obj_ary_transient); } diff --git a/debug_counter.h b/debug_counter.h index 2add2ac..cb2222a 100644 --- a/debug_counter.h +++ b/debug_counter.h @@ -206,6 +206,7 @@ RB_DEBUG_COUNTER(obj_str_fstr) https://github.com/ruby/ruby/blob/trunk/debug_counter.h#L206 RB_DEBUG_COUNTER(obj_ary_embed) RB_DEBUG_COUNTER(obj_ary_transient) RB_DEBUG_COUNTER(obj_ary_ptr) +RB_DEBUG_COUNTER(obj_ary_extracapa) /* ary_shared_create: shared ary by Array#dup and so on. ary_shared: finished in shard. -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/