std-simd icon indicating copy to clipboard operation
std-simd copied to clipboard

Examples in README.md are not equivalent

Open Lastique opened this issue 2 years ago • 0 comments

The examples given in the front page (README.md) are not equivalent. That is, the examples showing native_simd and compiler intrinsics are not vectorization of the original scalar_product function because:

  • Their Vec3D array contains a different number of elements. In the original code, there are 3 floats in the array, and the modified examples use vector types for elements, where the vector type itself is a number of floats. The vectorized functions should operate on the same input data as the original. Yes, that means you should probably show how your library helps dealing with tail data that doesn't fit in a native vector.
  • The effect of the scalar_product function in the modified examples is different, as it does not produce a single float that is the sum of products of the input arrays. The vectorized code is missing the final reduction step.

I understand that you are trying to be concise in your front page examples, but I still believe the examples should provide user with a realistic comparison of the two ways to implement the same functionality. Without this equivalence, the comparison is pointless, as you are comparing apples to oranges.

Lastique avatar Nov 21 '23 12:11 Lastique