3 ms·
The speedup is interesting. I specially like to read other example where killing an `if` increase the performance easily. `if`s are bad! The SIMD operations g
by gus_massa 10y ago
The speedup is interesting.
I specially like to read other example where killing an `if` increase the performance easily. `if`s are bad!
The SIMD operations get much more speed, but here we can start a discussion about portability and maintainability. It's a trick to use only in a very special case.
Anyway, removing the consecutive duplicates of a vector is an O(N) operation, but sorting the vector is an O(N log(N)) operation. So in any real example the sorting part will be slower than the removing part. To make the whole operation quicker it's better to improve the sorting part.
It's a nice article, but hiding the slowest part of the operation under the rug is a bit misleading.