Add a fast-path for mrb_type

By adding a fast-path where we ignore boxed types we can gain a pretty substantial speedup of mrb_iv_get, making it about 25% faster during a standard optcarrot benchmark run.

NOTE: It is just mrb_iv_get that is that much faster, the whole benchmark seems to be about 3-5% faster with word boxing.
This commit is contained in:
Aurora Nockert
2024-06-27 22:44:36 +02:00
parent 27f972b048
commit 646c37ecda
4 changed files with 32 additions and 8 deletions
+1 -1
View File
@@ -282,7 +282,7 @@ mrb_vm_special_set(mrb_state *mrb, mrb_sym i, mrb_value v)
static mrb_bool
obj_iv_p(mrb_value obj)
{
switch (mrb_type(obj)) {
switch (mrb_unboxed_type(obj)) {
case MRB_TT_OBJECT:
case MRB_TT_CLASS:
case MRB_TT_MODULE: