Bug introduced in 6.0 and persisting through 14.0.
I have found that multidimensional Reverse
is ~10 times slower than exact -1 ;; 1 ;; -1
:
n = 1000;
mat = RandomReal[1, {n, n}];
mat2 = Reverse[mat, 2]; // AbsoluteTiming
mat3 = mat[[All, -1 ;; 1 ;; -1]]; // AbsoluteTiming
(* {0.088234, Null} *)
(* {0.006836, Null} *)
mat2 == mat3
(* True *)
Why? Is it a bug?
Both produced arrays are packed.
I use Mathematica 9.0.1 on Linux. Mathematica 8 has the same problem.
Reply from the Wolfram Technical Support:
Thank you for your message.
I could reproduce this performance issue on Mathematica 9.
I have filed a report on this to our database and thank you for bringing this issue to our attention.
Wolfram Technical Support case identification : [CASE:424077]