Dractic slowdown in the performance of Table

Let’s initialize

a = Table[Random[], {1460}, {361}, {720}];

Then use some elements to form another table

Table[a[[1, i, 1]], {i, 1, 100}]; // AbsoluteTiming

This operation takes very little time

out[] = {0.0004528, Null}

But just a bit large Table (from 1 to 361)

Table[a[[1, i, 1]], {i, 1, 361}]; // AbsoluteTiming

takes crazy long

out[]= {67.1042, Null}

What is a problem?

P.S. Mathematica ver. 13.3. RAM is sufficient.

I don’t know why the longer time, but this seems to be a workaround:

a[[1, 1 ;; 100, 1]]; // Timing
a[[1, All, 1]]; // Timing

sure, there are many alternative ways to take elements but I need this Table because in fact the processing is much more complex (I don’t show all operations over a[[1, i, 1]]).

The time is spent attempting to compile (I believe eventually with success) the last Table command because it has exceeded the default auto-compile length of 250. This involves, among other things, a full iteration over the table (I do not know all the details here).

Table can be dissuaded from doing this as below.

SetSystemOptions["CompileOptions"->"TableCompileLength"->Infinity];
a = Table[Random[], {1460}, {361}, {720}];

In[3]:= Table[a[[1, i, 1]], {i, 1, 100}]; // AbsoluteTiming

(* Out[3]= {0.000062, Null} *)

In[4]:= Table[a[[1, i, 1]], {i, 1, 361}]; // AbsoluteTiming

(* Out[4]= {0.000177, Null} *)

I will file a suggestion report that this handling be reconsidered with an eye toward optimizing it for better speed.

Great, it works! Thanks