That doesn't help you if you're stuck using a library that doesn't perform those optimizations, but it means you need to be careful about importing your assumptions about regex performance from one language to another.
See also: https://github.com/burntSushi/rebar
> a linear find should be equivalent to a well implemented regex search for a specific string of characters
This is only true theoretically. If your regex engine is just a DFA scan that does char-at-a-time matching, then any "well implemented" substring search algorithm is going to blow it out of the water because it likely uses SIMD. Of course, many regex engines (including RE2), detect literals in the regex and use SIMD to scan for it. So while "DFA scan that does char-a-time matching" is a fine semantic model to have (to a first approximation) for a finite automata based regex engine, the model breaks down pretty quickly for reasoning about performance in general.
But KMP and similar algorithms can do better; they can get performance approaching O(n/k) for many cases by not even looking at every character of the input string.
There is a variant of Boyer Moore which is sublinear and linear in the worst case, but it's not that fast by modern standards.
The fastest sub linear search algorithms I know that remain linear in the worst case are Linear Weak Factor Recognition (LWFR) and Linear Hash Chain (LHC). LHC is currently unpublished (I'm writing a paper on it right now).
I don't mean to 100% disagree with you, but I think it's misleading to suggest a sort of one dimensional view of things where, as the pattern gets larger, SIMD gets worse compared to sublinear search algorithms. There are other factors at play here, and, importantly, what "long" means in this context.
In many practical circumstances, "short" might be a few bytes, while "long" is 16 bytes. But maybe your idea of "long" is actually much longer.
If you're curious how your own algorithm stacks up to ripgrep's, you can plug your implementation into the `memchr` crate's benchmark harness: https://github.com/BurntSushi/memchr
It uses rebar: https://github.com/BurntSushi/rebar
I'd say a long pattern is more like 64 bytes (the benchmarking suite I use defines short patterns as 32 or under).
Edit: will also check out the frequency approach used in ripgrep, sounds fascinating.
https://blog.burntsushi.net/ripgrep/
https://blog.burntsushi.net/regex-internals/
64 bytes is decently long, but I'd still put my money on SIMD for "common" cases.
In most cases the parser will not be shorter (code) than the regex, but it will most certainly be simpler (cognitively; it's hard to understand all that regexes do, they're close to magic) and more testable (you can test the parts of the parser, like the number parser or the string parser, individually), and often faster too.
But yes, you're right. Sometimes simple finds are sufficient.