# Parallelize in Mathematica [duplicate]

Here is two test to understand the parallelize in Mathematica:

Table[{x,y,x}, {x,300}, {y,300}, {z,300}];//AbsoluteTiming
{2.39232, Null}

Parallelize[Table[{x,y,x}, {x,300}, {y,300}, {z,300}]];//AbsoluteTiming
{11.5578, Null}

ParallelTable[{x,y,z}, {x,300}, {y,300}, {z,300}]; // AbsoluteTiming
{11.5914, Null}


Here the parallelize get more time! Why and how to parallelize a loop?

• @Developer2000 many people think: it's parallelized, so it should be faster. But this isn't true. Parallelization isn't for free; it involves some overhead that is not present in the serial calculation. This is especially true in Mathematica, where the Parallel` package is written entirely in top-level code, and communication is via MathLink. It can be compared to MPI, rather than threading, but even slower because MathLink is not carefully tuned for latency and bandwidth. Unless you're very careful, Amdahl's law completely kills you. – Oleksandr R. Dec 13 '15 at 20:26