diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-07-09 16:39:28 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-07-09 16:39:28 +0900 |
commit | 5e79d5a5608f9018a3deab53df9b2d7f42c9c464 (patch) | |
tree | d0410c5ab2ba1829b9631e61571b85ef2607d129 /benchmark/string_rpartition.yml | |
parent | e2257831ab20915b839eeaff79c6ec45b498de77 (diff) |
Make `rb_str_rindex` return byte index
Leave callers to convert byte index to char index, as well as
`rb_str_index`, so that `rb_str_rpartition` does not need to
re-convert char index to byte index.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8047
Diffstat (limited to 'benchmark/string_rpartition.yml')
-rw-r--r-- | benchmark/string_rpartition.yml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/benchmark/string_rpartition.yml b/benchmark/string_rpartition.yml new file mode 100644 index 0000000000..37e9d1b071 --- /dev/null +++ b/benchmark/string_rpartition.yml @@ -0,0 +1,18 @@ +prelude: | + str1 = [*"a".."z",*"0".."9"].join("") + str10 = str1 * 10 + ":" + str100 = str1 * 100 + ":" + str1000 = str1 * 1000 + ":" + nonascii1 = [*"\u{e0}".."\u{ff}"].join("") + nonascii10 = nonascii1 * 10 + ":" + nonascii100 = nonascii1 * 100 + ":" + nonascii1000 = nonascii1 * 1000 + ":" +benchmark: + rpartition-1: str1.rpartition(":") + rpartition-10: str10.rpartition(":") + rpartition-100: str100.rpartition(":") + rpartition-1000: str1000.rpartition(":") + rpartition-nonascii1: nonascii1.rpartition(":") + rpartition-nonascii10: nonascii10.rpartition(":") + rpartition-nonascii100: nonascii100.rpartition(":") + rpartition-nonascii1000: nonascii1000.rpartition(":") |