I alway runt test with compiler optimization ON and outside IDE. I also set the task priority to 'High' or 'Real time'. This way I can get always almost the same result every time I run the program.
Anyway the reason for why your function was slow was that I called the 'random' function in the big loop. After fixing that, your function scored 2-3 times faster than Borland's. Yupi !!! Wilfried Mestdagh wrote: > Hello, > > >> I tested that function, and strangely it takes 2640ms. >> > > Delphi does a great optimization. Be sure to have debug information all > of, and optimization on, rebuild and run outside the IDE. > > Don't use other funtions that can take a lot of time like Random. If a > CPU has to compare it take no more or less time if it is large or small > numbers or any number at all. so you only have to have all combinations > in your test function. > > 1, 2, 3 > 2, 3, 1 > 3, 1, 2 > 2, 1, 3 > 1, 3, 2 > 3, 2, 1 > > Are there more ? > > --- > Rgds, Wilfried > http://www.mestdagh.biz > > _______________________________________________ > Delphi mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi > > _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

