That doesn't make sense. If you have loop with length you have to check both the content of the byte and the index; if you have null terminated strings you only check the content of the byte.
https://lemire.me/blog/2020/09/03/sentinels-can-be-faster/?a...
Results:
N = 10000
range 1218.1
sentinel 937.258
mine 672.227
ratio 1.29964
(ratio is range/sentinel, not mine/whatever)You can get even more crazy with SIMD. But for all that you need to know the length beforehand.
Edit: The b4 variable should actually be called b8. That's a remnant of a previous version, where I used 32-bit chunks.