Files
ruby/benchmark/string_inspect.yml
Mari Imaizumi b7aa15f594 Improve performance of String#inspect with an ASCII bulk-skip fast path
Bulk-skip ASCII bytes that need no escaping via a 256-byte lookup
table, avoiding per-byte `rb_enc_precise_mbclen` and `rb_enc_mbc_to_codepoint`
calls. Eligible for well-formed strings (CR=7BIT, or UTF-8 VALID);
other strings fall through to the existing path unchanged.
2026-06-05 12:33:15 +09:00

14 lines
477 B
YAML

prelude: |
ascii = "Hello, World! This is a benchmark test string." * 100
utf8 = "こんにちは世界。これはベンチマーク用のテスト文字列です。" * 100
mixed = ("Hello World! " + "テスト" + " is great! ") * 100
binary = ("\xE3\x81\x82" * 100).b
escapy = "\n\t\"\\\#" * 100
benchmark:
inspect_ascii: ascii.inspect
inspect_utf8: utf8.inspect
inspect_mixed: mixed.inspect
inspect_binary: binary.inspect
inspect_escapy: escapy.inspect