In my previous PR the case without leftovers marginally deteriorated. There was two equivalent condition checks: if count <= len then before the main loop and then
let lenLessCount = len - count
let mutable i = 0
while i <= lenLessCount do
On the first iteration the two conditions are the same. Moving the leftover check below the loop makes the speed equal to the original version for the case without leftovers, but is still faster when there are leftovers.
In my previous PR the case without leftovers marginally deteriorated. There was two equivalent condition checks:
if count <= len then
before the main loop and thenOn the first iteration the two conditions are the same. Moving the leftover check below the loop makes the speed equal to the original version for the case without leftovers, but is still faster when there are leftovers.