summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-03 08:13:31 +0000
committertmm1 <tmm1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-03 08:13:31 +0000
commit42582358768c50a3e0aa9455218070b19ce7c489 (patch)
treecb90882ed36c04553349aabd2d6ee0502b6f33f0
parent084b602d9a52b62a04d17f65ba1a9b8a767d1e3e (diff)
* load.c (features_index_add_single): Move loaded_features_index array values off
the ruby heap. [Bug #9201] [ruby-core:58805] * load.c (loaded_features_index_clear_i): Clean up off-heap array structure. * vm.c (rb_vm_mark): Remove unnecessary mark_tbl for loaded_features_index. This improves minor GC time by 15% in a large application. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--load.c8
-rw-r--r--vm.c3
3 files changed, 15 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 862e889505..920cc5bbe3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Dec 3 17:11:47 2013 Aman Gupta <ruby@tmm1.net>
+
+ * load.c (features_index_add_single): Move loaded_features_index array values off
+ the ruby heap. [Bug #9201] [ruby-core:58805]
+ * load.c (loaded_features_index_clear_i): Clean up off-heap array structure.
+ * vm.c (rb_vm_mark): Remove unnecessary mark_tbl for loaded_features_index.
+ This improves minor GC time by 15% in a large application.
+
Tue Dec 3 17:01:45 2013 Aman Gupta <ruby@tmm1.net>
* include/ruby/ruby.h (struct RClass): Add wrapper struct around
diff --git a/load.c b/load.c
index 141c02f33b..f31b7aeaca 100644
--- a/load.c
+++ b/load.c
@@ -203,7 +203,8 @@ features_index_add_single(VALUE short_feature, VALUE offset)
VALUE feature_indexes[2];
feature_indexes[0] = this_feature_index;
feature_indexes[1] = offset;
- this_feature_index = rb_ary_tmp_new(numberof(feature_indexes));
+ this_feature_index = (VALUE)xcalloc(1, sizeof(struct RArray));
+ RBASIC(this_feature_index)->flags = T_ARRAY; /* fake VALUE, do not mark/sweep */
rb_ary_cat(this_feature_index, feature_indexes, numberof(feature_indexes));
st_insert(features_index, (st_data_t)short_feature_cstr, (st_data_t)this_feature_index);
}
@@ -263,6 +264,11 @@ features_index_add(VALUE feature, VALUE offset)
static int
loaded_features_index_clear_i(st_data_t key, st_data_t val, st_data_t arg)
{
+ VALUE obj = (VALUE)val;
+ if (!SPECIAL_CONST_P(obj)) {
+ rb_ary_free(obj);
+ xfree((void *)obj);
+ }
xfree((char *)key);
return ST_DELETE;
}
diff --git a/vm.c b/vm.c
index 7b3447f9c4..cef29978a2 100644
--- a/vm.c
+++ b/vm.c
@@ -1612,9 +1612,6 @@ rb_vm_mark(void *ptr)
if (vm->loading_table) {
rb_mark_tbl(vm->loading_table);
}
- if (vm->loaded_features_index) {
- rb_mark_tbl(vm->loaded_features_index);
- }
rb_vm_trace_mark_event_hooks(&vm->event_hooks);