Basic Examples (2)
Basic Examples
(2)
MapBatched applies a function to a list or association. By default, batches consist of 5 entries, and the action taken is to for one second per batch:
Out[2]=
{3.00432,{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}}
The result using identical to an ordinary except for inserting this :
MapBatched
Map[#&,Range[20]]//AbsoluteTiming
Out[1]=
{0.000058,{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}}
———
When the number of elements is less than the batch size, no is inserted:
In[3]:=
Out[3]=
{0.000053,{1,2,3,4,5}}
Scope (2)
Scope
(2)
Applications (3)
Applications
(3)