mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
+4
-2
@@ -522,8 +522,10 @@ mrb_ary_push_m(mrb_state *mrb, mrb_value self)
|
||||
}
|
||||
array_copy(ARY_PTR(a)+len, argv, alen);
|
||||
ARY_SET_LEN(a, len2);
|
||||
mrb_write_barrier(mrb, (struct RBasic*)a);
|
||||
|
||||
while (alen--) {
|
||||
mrb_field_write_barrier_value(mrb, (struct RBasic*)a, *argv);
|
||||
argv++;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user