In your example, you originally create a packed array. If you read about packed arrays in the answers in the linked question, in documentation or elsewhere, you will see that these are special objects, lower-level than general Mathematica lists / expressions.
Because of this, not all Mathematica operations preserve these objects. Those which don't are said to unpack. Some considerations regarding (avoiding) unpacking can be found here. In particular, it was mentioned and illustrated there that Apply
necessarily unpacks. This is just because of its nature: it replaces the current head of an expression with a different head.
It is easy to check whether or not unpacking happens - use On["Packing"]
:
On["Packing"]
HoldComplete @@ Range[10]
During evaluation of In[125]:= Developer`FromPackedArray::punpack1: Unpacking array with dimensions {10}. >>
(* HoldComplete[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] *)
Off["Packing"]
Unpacking is a process of replacing a packed array with its unpacked, higher-level equivalent generic Mathematica list. For large arrays, this can take quite some time, which is what you observed. This has nothing to do with HoldComplete
, because unpacking happens slightly earlier, and has nothing to do directly with the top-level evaluation - which is the only evaluation that HoldComplete
may affect. Unpacking is a lower-level action.
HoldComplete
unpacks, whenApply
is used (or, rather,Apply
unpacks). $\endgroup$