Does norm use maxabs? If so this could be due to maxabs getting compiled. try running both of the timed statements a second time.
On Wednesday, November 18, 2015 at 10:41:48 AM UTC-6, Sisyphuss wrote: > > 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. >