fsprojects / SIMDArray

SIMD enhanced Array operations
MIT License
132 stars 15 forks source link

Move redundant condition check below the while loop #10

Closed buybackoff closed 8 years ago

buybackoff commented 8 years ago

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.