I tested my loop monre than 2 times as it is written in my post and I have always the same results. The function Tim Holy posted is much faster, I posted the results above :)
> Probably you are doing this wrong; it shouldn't be allocating so much > memory. Is your loop using global variables? Did you remember to time it > twice (since the first time you call it there is compilation overhead.) > Did you try the function Tim Holy posted? >