diff options
| author | dearblue <[email protected]> | 2019-07-11 21:52:05 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2019-07-11 22:09:15 +0900 |
| commit | 8c0d9ba1a363683bbeab8cb7c22acdb07621352d (patch) | |
| tree | 11ddfa32f3f408b1d5220883e7a6857124dbe526 /src/variable.c | |
| parent | 5420895bcb14bdef8fd35d1abab09f63a003baed (diff) | |
| download | mruby-8c0d9ba1a363683bbeab8cb7c22acdb07621352d.tar.gz mruby-8c0d9ba1a363683bbeab8cb7c22acdb07621352d.zip | |
Improve performance `String#index` with UTF-8
Based on Boyer-Moore-Horspool algorithm (Quick Search algorithm).
As a side effect, the correct position is returned even if an invalid UTF-8
string is given.
```console
% ./mruby@master -e 'p ("\xd1" * 100 + "#").index("#")'
50
% ./mruby@improve-index -e 'p ("\xd1" * 100 + "#").index("#")'
100
```
The other behavior should be the same as the current implementation.
Diffstat (limited to 'src/variable.c')
0 files changed, 0 insertions, 0 deletions
