mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
f4d2117d7d
Replace massive 40+ case switch statement in read_tmpl() with direct format_table[256] lookup for standard format characters. This eliminates branch prediction overhead and reduces function size from 290 to ~90 lines. Key improvements: - O(1) format character resolution vs O(n) switch traversal - Preserved runtime-dependent format handling (I, i, J, j) - Maintained full backward compatibility with all existing tests - Better instruction cache usage with smaller function size - Consistent template parsing performance across format types Co-authored-by: Claude <noreply@anthropic.com>