
Linear Searching 200MB with Ruby, Node, and Go - jotto
https://www.jonathanotto.com/linear-search-benchmark
======
jimsmart
In Go, using strings.Index (from the standard library) will probably out-
perform the naive algorithm used in the article — it's well optimised and, for
that string length, will use Rabin-Karp search.

\-
[https://golang.org/src/strings/strings_amd64.go?s=720:752#L1...](https://golang.org/src/strings/strings_amd64.go?s=720:752#L17)

\-
[https://en.wikipedia.org/wiki/Rabin–Karp_algorithm](https://en.wikipedia.org/wiki/Rabin–Karp_algorithm)

One would imagine that similar algorithm implementations also exist for the
other languages too.

------
mattbillenstein
pypy 2.7.13 ~700ms Python 2.7.13 ~63s

[https://gist.github.com/mattbillenstein/39f0399e842c63355c74...](https://gist.github.com/mattbillenstein/39f0399e842c63355c74173e34d49965)

~~~
mattbillenstein
string.find takes ~40ms

