diff options
author | Peter Zhu <[email protected]> | 2021-11-19 14:51:58 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2021-11-23 10:51:27 -0500 |
commit | 9aded89f4071a8afb79326701789241f1da12f82 (patch) | |
tree | 4869f264a95718d7c6882564cf0d19a913fe952e /class.c | |
parent | c14f230b26aa4f8abe9ecf3814cfebbe584d77c9 (diff) |
Speed up Ractors for Variable Width Allocation
This commit adds a Ractor cache for every size pool. Previously, all VWA
allocated objects used the slowpath and locked the VM.
On a micro-benchmark that benchmarks String allocation:
VWA turned off:
29.196591 0.889709 30.086300 ( 9.434059)
VWA before this commit:
29.279486 41.477869 70.757355 ( 12.527379)
VWA after this commit:
16.782903 0.557117 17.340020 ( 4.255603)
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5151
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -203,7 +203,9 @@ class_alloc(VALUE flags, VALUE klass) RVARGC_NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | FL_PROMOTED1 /* start from age == 2 */ | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0), alloc_size); -#if !USE_RVARGC +#if USE_RVARGC + memset(RCLASS_EXT(obj), 0, sizeof(rb_classext_t)); +#else obj->ptr = ZALLOC(rb_classext_t); #endif |