Well, it depends entirely on the environment. AFAIK MSVC runtime makes strstr the most naive way in O (n * m) complexity. But brute force does not require additional memory space, so it never raises a bad alloc exception. KMP requires O (m) extra space, and Two-Way requires constant extra space.
What GCC makes sounds is the same as using FFT to calculate multiplications. It looks very fast in paper, but actually very slow. MSVC will use the SIMD instructions in strstr when they are available, so in most cases they will be faster. I will choose a brute force approach with SIMD if I am going to write my own library.
source share