mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
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.
14 lines
477 B
YAML
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
|