# Is there documentation on the comparative performance of Mathematica functions? [duplicate]

Recently I have been solving some Project Euler problems. I find there are always several ways to do the same thing. For example, one could join two lists like this:

a = {2, 1};
b = {2, 3};
Union[a, b]
Join[a, b]


Which gives

{1, 2, 3}
{2, 1, 2, 3}

So the Union function sorts the element and deletes duplicates. I guess the Join function will be faster, but how much faster? In a loop, would it be more efficient to use Join and DeleteDuplicates at each 100th step?

Is there documentation of the comparative performance of Mathematica functions? Because heuristics as above could be totally wrong, and I don't know how much experimenting it would take to form a good understanding of the complexity of functions.

## marked as duplicate by Kuba♦, Yves Klett, Michael E2, Sjoerd C. de Vries, Dr. belisariusApr 28 '14 at 14:08

• Performance tuning in Mathematica is more complicated than that. Start a fresh kernel and try {Timing[Prime[10000000000]][[1]], Timing[Prime[10000000000]][[1]]}. Also, many of the algorithms use heuristics to switch between strategies when appropriate. – Dr. belisarius Apr 1 '13 at 15:21