diff options
author | Lourens Naudé <lourens@bearmetal.eu> | 2019-04-20 00:44:51 +0100 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-07 21:58:55 +0900 |
commit | a47f598d77ac97f9fe89fe16aa8bcab4fd262c16 (patch) | |
tree | 069ca07cf1e65cc9d253dab5101d23bed933c21a /gc.c | |
parent | 7d805e67f3275aef066d77aa9c32bef715c362ed (diff) | |
download | ruby-a47f598d77ac97f9fe89fe16aa8bcab4fd262c16.tar.gz |
Reduce ONIG_NREGION from 10 to 4: power of 2 and testing revealed most pattern matches are less than or equal to 4 results
Closes: https://github.com/ruby/ruby/pull/2135
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -2436,6 +2436,17 @@ obj_free(rb_objspace_t *objspace, VALUE obj) case T_MATCH: if (RANY(obj)->as.match.rmatch) { struct rmatch *rm = RANY(obj)->as.match.rmatch; +#if USE_DEBUG_COUNTER + if (rm->regs.num_regs >= 8) { + RB_DEBUG_COUNTER_INC(obj_match_ge8); + } + else if (rm->regs.num_regs >= 4) { + RB_DEBUG_COUNTER_INC(obj_match_ge4); + } + else if (rm->regs.num_regs >= 1) { + RB_DEBUG_COUNTER_INC(obj_match_under4); + } +#endif onig_region_free(&rm->regs, 0); if (rm->char_offset) xfree(rm->char_offset); |