This function does make a big difference in some cases.
julia> x = rand(512);
julia> @btime minimum($x)
848.195 ns (0 allocations: 0 bytes)
0.0004658392690449764
julia> @btime reduce((x,y) -> x<y ? x : y, $x, init=Inf)
395.203 ns (0 allocations: 0 bytes)
0.0004658392690449764
julia> @btime reduce((x,y) -> @fastmath(x < y) ? x : y, $x, init=Inf)
33.046 ns (0 allocations: 0 bytes)
0.0004658392690449764
@fastmath
isn’t just about swapping out one implementation for another, but about communicating assumptions to the compiler about transformations it is allowed to apply.
In this case, it tells the compiler it is allowed to do a SIMD reduction.
Doing so risks missing NaN values, but if we promise no-nans, then reordering this reduction sequence is suddenly legal.