in reply to Re^3: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
in thread Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
Algorithms should scale quite differently to this. Char based solutions (bit ops, tr) would not profit. String / regexp based solutions like index, s//, split could gain speed. I'm not a regexp engine guru, but I assume the engine is intelligent enough not to compare char with char in this situation. In the most common case you get away with comparing the 1st char of the search string with every 3rd char of the long "text" string. That's a 3-fold speed increase.
Thanks to very experienced monks the regexp engine is not too bad in real world use cases.
Edit: Even index takes more than one char.