I have a file that\'s 21056 bytes.
I\'ve written a program in C that reads the entire file into a buffer, and then uses multiple search algorithms to search the file
Without seeing your code, it's hard to say exactly. strstr
is heavily optimized, and usually written in assembly language. It does things like reading data 4 bytes at a time and comparing them (bit-twiddling if necessary if the alignment isn't right) to minimize memory latency. It can also take advantage of things like SSE to load 16 bytes at a time. If your code is only loading one byte at a time, it's probably getting killed by memory latency.
Use your debugger and step through the disassembly of strstr
-- you'll probably find some interesting things in there.