Interesting phenomenon: norm() is faster than maxabs()

x = randn(100000)
@time maxabs(x)
@time norm(x)


0.000108 seconds (5 allocations: 176 bytes) 
0.000040 seconds (5 allocations: 176 bytes)

I have thought the contrary, for norm() requires N square and 1 square 
root; maxabs() requires 2N change of sign bit and N comparison.

Reply via email to