rust/src/libcollectionstest
bors 7fc0675f35 Auto merge of #26327 - bluss:two-way, r=aturon
Update substring search to use the Two Way algorithm

To improve our substring search performance, revive the two way searcher
and adapt it to the Pattern API.

Fixes #25483, a performance bug: that particular case now completes faster
in optimized rust than in ruby (but they share the same order of magnitude).

Many thanks to @gereeter who helped me understand the reverse case
better and wrote the comment explaining `next_back` in the code.

I had quickcheck to fuzz test forward and reverse searching thoroughly.

The two way searcher implements both forward and reverse search,
but not double ended search. The forward and reverse parts of the two
way searcher are completely independent.

The two way searcher algorithm has very small, constant space overhead,
requiring no dynamic allocation. Our implementation is relatively fast,
especially due to the `byteset` addition to the algorithm, which speeds
up many no-match cases.

A bad case for the two way algorithm is:

```
let haystack = (0..10_000).map(|_| "dac").collect::<String>();
let needle = (0..100).map(|_| "bac").collect::<String>());
```

For this particular case, two way is not much faster than the naive
implementation it replaces.
2015-06-30 18:09:51 +00:00
..
bit Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
btree Auto merge of #26190 - Veedrac:no-iter, r=alexcrichton 2015-06-11 18:10:08 +00:00
bench.rs More test fixes 2015-04-14 10:14:19 -07:00
binary_heap.rs Implement RFC 839 2015-06-08 12:05:33 +02:00
enum_set.rs Implement RFC 839 2015-06-08 12:05:33 +02:00
fmt.rs
lib.rs Remove remaining use of bit_vec_append_splitoff feature gate. 2015-06-24 12:08:57 +02:00
linked_list.rs Implement RFC 839 2015-06-08 12:05:33 +02:00
slice.rs More test fixes 2015-04-14 10:14:19 -07:00
str.rs StrSearcher: Update substring search to use the Two Way algorithm 2015-06-21 19:58:50 +02:00
string.rs Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00
vec_deque.rs Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00
vec_map.rs Implement RFC 839 2015-06-08 12:05:33 +02:00
vec.rs Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00