summaryrefslogtreecommitdiff
path: root/benchmark/string_slice.yml
blob: fc2393c5d17aa6c7a4fc5ed5695cb8af48e554a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
prelude: |
  long_string = "x"*1000+"-hår"
benchmark:
  regexp-short: |
    "x-hår".slice!(/-(.)(.)(.)/, 3)
  regexp-long: |
    long_string.dup.slice!(/-(.)(.)(.)/, 3)
  string-short: |
    "x-hår".slice!("r")
  string-long: |
    long_string.dup.slice!("r")