Anonymous user
Permutations: Difference between revisions
m
→Fortran Speed Test
Line 2,080:
=== Fortran Speed Test ===
So
Here below is the speed test for a couple of algorithms of permutation. We can add more algorithms into this frame-work. When they work in the same circumstance, we can see which is the fastest one.
Line 2,146:
! Finishing (1)
!
write(*,*) "1) subnexper:
write(*,*) 'Total permutations :', ic
write(*,*) 'Total time elapsed :', dt
Line 2,170:
! Finishing (2)
!
write(*,*) "2)
write(*,*) 'Total permutations :', ic
write(*,*) 'Total time elapsed :', dt
Line 2,192:
! Finishing (3)
!
write(*,*) "3)
write(*,*) 'Total permutations :', ic
write(*,*) 'Total time elapsed :', dt
Line 2,234:
! Finishing (4)
!
write(*,*) "4) nextp:
write(*,*) 'Total permutations :', ic
write(*,*) 'Total time elapsed :', dt
Line 2,455:
10
N = 10
1) subnexper:
Total permutations : 3628800
Total time elapsed : 4.9000000000000002E-002
2) generate:
Total permutations : 3628800
Total time elapsed : 0.84299999999999997
3) perm:
3) Recursion: (2nd fast with ifort, 3rt with gfortran)▼
Total permutations : 3628800
Total time elapsed : 5.6000000000000001E-002
4) nextp:
Total permutations : 3628800
Total time elapsed : 2.9999999999999999E-002
Line 2,475:
10
N = 10
1) subnexper:
Total permutations : 3628800
Total time elapsed : 8.240000000000000E-002
2) generate:
Total permutations : 3628800
Total time elapsed : 0.616200000000000
3) perm:
3) Recursion: (2nd fast with ifort, 3rt with gfortran)▼
Total permutations : 3628800
Total time elapsed : 5.760000000000000E-002
4) nextp:
Total permutations : 3628800
Total time elapsed : 3.600000000000000E-002
So far, we have conclusion from the above performance:
+ generate is the slowest one with not only ifort but gfortran.
+ nextp is the fastest one with both ifort and gfortran. (The winner in this test)
Note: It is worth mentioning that the performance of this test is dependent not only on algorithm, but also on computer where the test runs. Therefore we should run the test on our own computer and make conclusion by ourselves.
=== Fortran 77 ===
|