|
|
|
|
|
by GrumpySloth
1086 days ago
|
|
When you have the length, you can unroll the loop, so that you e.g. do 4 iterations at a time. With NUL you can’t do that. Moreover, loop iteration can be done in parallel (instruction-level parallelism) with processing the content of the string, since there is no data dependency between the two. With NUL you introduce a data dependency. |
|
https://lemire.me/blog/2020/09/03/sentinels-can-be-faster/?a...