Get the latest tech news
Faster Argmin on Floats
If you know that you are working with "regular" floats, you can make argmin faster.
Consider the following problem: you are given a dynamically large array of NNN floating point numbers, and you are asked to find the index of the smallest one (commonly called arg min\argminargmin) as fast as possible. When optimizing this, my first instinct was to implement our own comparator function, using the natural partial order of floats. Based on this, we can use a very elegant property of floating point representation: you can sort the f32 values as u32, if you have only positive numbers.
Or read this on Hacker News