Thank you for the answer. I did not post my code because it is pretty long and I tried to concentrate to the delicate point. It was my fault because your answer does not work in my case.
Assuming that n=10^6. I have a list of this kind
a=RandomReal[{0,1},1000000];
then using this numbers I calculate these lists:
d = 4;
df = RandomVariate[PoissonDistribution[d], n];
p = RandomSample[a, n];
p1 = RandomSample[a, n];
p2 = RandomSample[a, n];
pp = Table[RandomSample[a, df[[i]]], {i, 1, n}];
as you can see pp is the irregular one the others are one level lists.
The function, that I need to evaluate, is (y is just a real number)
S2[y_, d_, p_, p1_, p2_, pp_] :=
y (1 - p - d/2*(Exp[-y] p1 p2)/(1 - (1 - Exp[-y]) p1 p2)) +
Log[Exp[-y] + (1 - Exp[-y]) Product[1 - j, {j, pp}]] -
d/2 Log[1 - (1 - Exp[-y]) p1 p2]
At this point I calculated the million of contributions
Table[S2[y, d, p[[i]], p1[[i]], p2[[i]], pp[[i]]], {i, 1, n}];
and then the mean (of course I can do two passage in one but the mean is not important here, I think).
In this case I do not understand how can I use Map instead of Table.
Then can you explain to me why Map is much more efficient than Table in this case?