mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
7e26271a01
Optimizes String#tr by hoisting RSTRING_PTR calls for pattern strings outside the main loop to avoid repeated conditional checks. Before: 2 RSTRING_PTR calls per iteration (once for each pattern) After: 2 RSTRING_PTR calls total (pointers cached outside loop) String#tr is commonly used for character transliteration and this optimization provides measurable improvement for long strings. Co-authored-by: Claude <noreply@anthropic.com>