1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/benchmark/string_split.yml
Nobuyoshi Nakada 02cb643ddb
Added String#split benchmark for empty regexp
|               |compare-ruby|built-ruby|
|:--------------|-----------:|---------:|
|re_chars-1     |    169.230k|  973.855k|
|               |           -|     5.75x|
|re_chars-10    |     25.536k|  107.598k|
|               |           -|     4.21x|
|re_chars-100   |      2.621k|   11.207k|
|               |           -|     4.28x|
|re_chars-1000  |     259.098|    1.133k|
|               |           -|     4.37x|
2020-05-12 22:59:58 +09:00

22 lines
641 B
YAML

prelude: |
str1 = [*0..5].join(" ") + " "
str10 = str1 * 10
str100 = str10 * 10
str1000 = str100 * 10
benchmark:
to_chars-1: str1.split('')
to_chars-10: str10.split('')
to_chars-100: str100.split('')
to_chars-1000: str1000.split('')
to_words-1: str1.split(' ')
to_words-10: str10.split(' ')
to_words-100: str100.split(' ')
to_words-1000: str1000.split(' ')
re_chars-1: str1.split(//)
re_chars-10: str10.split(//)
re_chars-100: str100.split(//)
re_chars-1000: str1000.split(//)
re_space-1: str1.split(/ /)
re_space-10: str10.split(/ /)
re_space-100: str100.split(/ /)
re_space-1000: str1000.split(/ /)