> I don't have time now to do the optimization for you now, sorry. I have improved your code a little, but I don't know the performance of this compared to the C# code: http://dpaste.dzfl.pl/0dab53bf85ad I compile and run it with ldc2 with: ldmd2 -wi -O -release -inline -noboundscheck -run test.d Bye, bearophile