Speaking as a guy who writes in assembly too, I'm not sure that much can be gained by BM at least on modern out-of-order processors. The cost of comparing every byte is low, and to skip a few bytes can cost more in additional instructions which can slow the pipeline than it would be by just searching through every byte for the first one. Other speedups (mmap) sound reasonable.
Comments
Speaking as a guy who writes in assembly too, I'm not sure that much can be gained by BM at least on modern out-of-order processors. The cost of comparing every byte is low, and to skip a few bytes can cost more in additional instructions which can slow the pipeline than it would be by just searching through every byte for the first one. Other speedups (mmap) sound reasonable.