Faster IndexOf for Substrings in .NET

Faster IndexOf for Substrings in .NET

A draft for #60866, real to study tests on CI.

A transient benchmark:

_data.IndexOf(“walking”, StringComparison.Ordinal); // or _data.AsSpan().IndexOf()

the usage of BenchmarkDotNet.Attributes;
the usage of BenchmarkDotNet.Working;


public class Benchmarks
    string _data = "I'm a man who walks alone and when I'm walking a...";

    public int IndexOf() => _data.IndexOf("walking", StringComparison.Ordinal); // or _data.AsSpan().IndexOf()


The algorithm is in step with

where for this particular observe “walking” we populate two 128/256bit vectors: and and note them to a recent chunk of the textual thunder material with an offset (distance betwe

Join the pack! Join 8000+ others registered users, and opt up chat, compose teams, post updates and compose chums across the enviornment!

Leave a Reply