Those numbers don't include any compilation (the allocations are too low). I'm seeing a similar thing. They're just implemented in really different ways. maxabs uses mapreduce, which seems to be a chronic source of less-than-optimal performance.
On Wed, Nov 18, 2015 at 2:12 PM, Benjamin Deonovic <bdeono...@gmail.com> wrote: > 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. >> >