Use mrb_field_write_barrier instead of mrb_write_barrier for push.

When the array is very big, the simpler `mrb_write_barrier` causes
calling `gc_mark_children` for big arrays repeatedly. That would hinder
performance very badly.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-07-22 14:21:05 +09:00
parent ff0e3bcea6
commit 2b45d454bc
+1 -1
View File
@@ -524,7 +524,7 @@ mrb_ary_push_m(mrb_state *mrb, mrb_value self)
}
array_copy(ARY_PTR(a)+len, argv, argc);
ARY_SET_LEN(a, len2);
while (alen--) {
while (argc--) {
mrb_field_write_barrier_value(mrb, (struct RBasic*)a, *argv);
argv++;
}