mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
8624764bca
Move the match loop for non-block gsub, sub, and scan from Ruby to C. Key improvements: - re_exec called directly in a loop without MatchData per match - MatchData created only once (for $~ of the last match) - Replacement \-escapes processed in C (apply_replacement) - No intermediate string objects for pre_match/post_match - Block variants remain in Ruby to avoid VM callbacks Performance improvement (vs CRuby ratio): gsub simple: 5.0x -> 2.9x scan words: 5.8x -> 1.9x Co-authored-by: Claude <noreply@anthropic.com>