mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Added method cache.
To enable method cache, define `MRB_METHOD_CACHE` or `MRB_METHOD_CACHE_SIZE`. The cache size must be power of 2. The default cache size is 128. The measurement: I measured simple benchmarks found in benchmark/ directory. With method cache enabled, we gained 6-8% performance improvement, with 97-99% cache hit rate.
This commit is contained in:
@@ -63,6 +63,7 @@ mrb_class(mrb_state *mrb, mrb_value v)
|
||||
}\
|
||||
}\
|
||||
} while (0)
|
||||
#define MRB_FLAG_IS_INHERITED (1 << 21)
|
||||
#define MRB_INSTANCE_TT_MASK (0xFF)
|
||||
#define MRB_SET_INSTANCE_TT(c, tt) c->flags = ((c->flags & ~MRB_INSTANCE_TT_MASK) | (char)tt)
|
||||
#define MRB_INSTANCE_TT(c) (enum mrb_vtype)(c->flags & MRB_INSTANCE_TT_MASK)
|
||||
|
||||
Reference in New Issue
Block a user