Re: I need the fastest routine



I find a little spare time to make change a bit on testing code to make it
simple and put some contribution code. Functions I added under my name are
nothing new, only optimized code of existed ideas in pure Pascal, forcing
compiler (with optimization turn on) to make almost ideal ASM code.

Few major chages are made:

- Simplifying testing code
- Putting sleep(10) before starting test
- Random number test
- Priority set to maximum during test to allow equal testing environment for
all functions
(priority change functions are from my SZTimer, can be found at
www.szutils.net, Delphi section)

MinMaxTest6.dpr is in attachment group.

The main difference makes using WHILE loop instead FOR, which is a bit
better optmized. Other optimizatioins are also made. However, perhaps can
be optimized a bit more, but have no more time to spend on this.

Results on 1 mil. random numbers test (Celeron 2.8):

1,309029s 13 9999999 Original
0,195020s 13 9999999 Original - optimized
0,266579s 13 9999999 Using pointers
0,217537s 960051513 0 Using pointers (8/loop) !!! BUG !!!
0,235024s 13 9999999 Using indices
0,257107s 13 9999999 Reading array value once
0,213859s 13 9999999 Nenad Trkulja - loop unrolling
0,198597s 13 9999999 Hubert Seidel - local min and max
0,838087s 13 9999999 Pierre le Riche - boolean trick
0,152449s 13 9999999 Trkulja/Seidel - loop unrolling and local min and
max
0,132889s 13 9999999 Gilberto Saraiva 8 ASM
0,122806s 13 9999999 Gilberto Saraiva 16 ASM
0,377528s 13 9999999 Hubert Seidel ASM
0,135966s 13 9999991 Hubert Seidel 8 PAS + ASM !!! BUG !!!
0,206225s 13 9999999 Hubert Seidel ASM V1
0,189716s 13 9999999 Hubert Seidel ASM V2
0,374263s 13 9999999 Hubert Seidel ASM V3
0,386615s 13 9999999 Hubert Seidel ASM Rollup 8
1,308774s 13 9999999 Clement Doss PAS 1
0,215284s 13 9999999 Clement Doss PAS 2
0,282143s 13 9999999 Sasa Zeman - pointers PAS
0,256864s 13 9999999 Sasa Zeman - indices (1) for PAS
0,261010s 13 9999999 Sasa Zeman - indices (2) while PAS
0,199161s 13 9999999 Sasa Zeman - indices (3) while PAS
0,144271s 13 9999999 Sasa Zeman - indices (4) while local 4 PAS
0,137221s 13 9999999 Sasa Zeman - indices (5) while local 8 PAS
0,123888s 13 9999999 Sasa Zeman - indices (6) while local 16 PAS


.