One have look spesifically at the assemble and instruction code generated.
But for algorithms that are going to iterate string data that terminated with a sentinal, and go look at ever value, one can reduce a assemble level if statement bounds or range check, so then those examples only single if statement, which much faster for comparisons. If I were writing assemble. For contiguous memory we're there is no sentinal to terminate string or characters, then parralizing the checking of the bounderies with comparison statement or other statements, would allow reduction in clock cycles, or instructions required. Boundary how can eliminate bounds, range checking, to reduce unessary if statements and write less assemble.
Only way I see that happen in the future is if a processor can execute two instructions simultaneous, involving different registers.
Imaging writing the assemble. And how reduce assemble code and instructions, as that's what ends up as, if can't if can't improve it at that level, with the cou instruction set, they won't be able more intelligently squize out more performance.
Guess other way, have compiler, identify the pattern rewrite the code, to spesific machine instruction set different if possible. That cpu could do at small scale for things does already. Compiler would be better. If don't improve or try few new things and look at if hardware like arm thinks it's possible good think to look at, as compiler could be updated, for new language support, to get more performance from there chips.
Obviously there is alot of compiler optermizations, but unless llvm we go to a list or someone can give more dire tion we have no idea how much further we can push things and creativity of our solutions. I think llvm and arm so would need to give there perspective take on much more juice they feel it allow them to squize out of the processors.
I know this not the most simple of things this one, there a few layers to this.
If you have contracts in these domains would be glad to chat with them to get more detail at other levels.